I just updated to iOS 12 and am now having issues getting the mobile app to connect to a P1 for setup. The issue is very similar to this one where my phone doesn’t seem to like that fact that there is no internet connection. Sometimes, it does connect but then it takes while for the Wi-Fi symbol to appear in the iPhone’s status bar (see image at bottom). Eventually, it will connect but it seems like it’s too late or the Particle app doesn’t pick up on the new network. The error messages I’m seeing in Xcode are:
NSURLConnection finished with error - code -1009
and
Event stream connection error = The Internet connection appears to be offline.
The same code was just working fine before updating to iOS 12.0, which leads me to believe this is more on the iOS side… anyone else experiencing this or have a workaround?
Hey @gusgonnet, this appears slightly related, but I'm not sure the issue is that the phone can't connect to the network at all. To be clear, my phone does connect to the network (see image in OP), and eventually does display the Wi-Fi connected icon in the status bar. Despite that, if I return to the iOS app, it never seems to recognize that I'm now connected to the "Photon-XXXX" network. On iOS I also don't just have the option to say "yes, connect to this network."
After debugging a bit, I was finding that the SSID doesn't seem to be stored properly when reading network info, and the application is getting stuck. This is the line that stores the network info in ParticleSetupCommManager.m:
info = (__bridge_transfer NSDictionary *)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
When evaluating this, Xcode is telling me that the CNCopyCurrentNetworkInfo needs special permissions to run now in iOS12:
Important
To use this function in iOS 12 and later, enable the Access WiFi Information capability for your app in Xcode. When you enable this capability, Xcode automatically adds the Access WiFi Information entitlement to your entitlements file and App ID.
I'm guessing this is my issue, now I just need to figure out how to enable "Access WiFi Information" capabilities to test.
Adjusting my app to have the “Access WiFi Information” capability did indeed work! My app now works again as expected, and has no issues connecting over SoftAP.
Note, you need to be enrolled in the Apple Developer Program in order to have this option available to you. Have to pay for membership , but you need that to publish an app to the App Store anyway. If you are not in the ADP, this specific capability won’t be listed as an option.
Hello everyone. I maintain iOS app at Particle (and iOS libs). Sorry for such late reply. Lately we’ve been very busy with adding Mesh support and only today I was told about this thread (and issue). I can confirm that this entitlement fixes the issue and I will submit app with this fix for Apple review today. If all goes well it should be available for download within next 24-36 hours (that’s how long apple review & appstore index update takes).
Right now I have very limited time to read these forums (and not sure how long it will take for that to change) unless someone points me to exact thread that I should read. If you think that you have found a problem with our iOS apps/libs don’t hesitate to tag me here so that I receive notification (still not 100% sure that works for me) and become aware of the problem as early as possible. You can also always ping me at raimis@particle.io or create an issue in respective github repo (preferred method). I get notifications for github issues and most of them get some kind of feedback the same or next business day.
I will post here as soon as I’m able to release an update. Right now the app is waiting for apple review, which I hope it will pass within next 12 hours.
I have just pressed release on latest build. It will become visible to all of you any time now (usually between 2 and 8 hours). Given the circumstances, we didn’t have enough time to do proper testing for this build, so if you happen to find something not working as expected, be sure to ping me
Thank you for your time reporting and discussing this issue. Special thanks to @mattw for posting a solution to the problem which has saved me a lot of time trying to understand what went wrong.