I have searched all over StackOverFlow but did not find any answer on how to use Required Device Capabilities or UIRequiresPersistentWiFi
.
How do I set values in my application such that the app only works on cellular data/WiFi in the iPhone?
Currently I have set the string WiFi property in the Required Device Capabilities Array according to iOSDeviceCompatibility.
Is this the correct approach or should I set UIRequiresPersistentWiFi
BOOL
to YES
?
Based on the documentation, setting this flag only makes sure that the device attempts to open a Wi-Fi connection. I'm not sure that it will guarantee that your networking will only occur on the Wi-Fi.
There's a class out there by apple called Reachability.
https://developer.apple.com/Library/ios/samplecode/Reachability/Introduction/Intro.html
There's also a reachability class in AFNetworking 2
https://github.com/AFNetworking/AFNetworking
I would set your UIRequiresPersistentWiFi flag to YES and then check the reachability class that there is a wi-fi connection available. If not, show an error.