[英]Limit application capabilities in IOS to only work with Cell/WiFi data.
I have searched all over StackOverFlow but did not find any answer on how to use Required Device Capabilities or UIRequiresPersistentWiFi
. 我搜遍了StackOverFlow,但没有找到任何关于如何使用必需设备功能或
UIRequiresPersistentWiFi
答案。
How do I set values in my application such that the app only works on cellular data/WiFi in the iPhone? 如何在我的应用程序中设置值,使应用程序仅适用于iPhone中的蜂窝数据/ WiFi?
Currently I have set the string WiFi property in the Required Device Capabilities Array according to iOSDeviceCompatibility . 目前我已根据iOSDeviceCompatibility在Required Device Capabilities数组中设置了字符串WiFi属性。
Is this the correct approach or should I set UIRequiresPersistentWiFi
BOOL
to YES
? 这是正确的方法还是我应该将
UIRequiresPersistentWiFi
BOOL
设置为YES
?
Based on the documentation, setting this flag only makes sure that the device attempts to open a Wi-Fi connection. 根据文档,仅设置此标志可确保设备尝试打开Wi-Fi连接。 I'm not sure that it will guarantee that your networking will only occur on the Wi-Fi.
我不确定它是否会保证您的网络只会在Wi-Fi上发生。
There's a class out there by apple called Reachability. 有一个名为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
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. 我会将您的UIRequiresPersistentWiFi标志设置为YES,然后检查可达性类是否存在可用的Wi-Fi连接。 If not, show an error.
如果没有,请显示错误。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.