简体   繁体   English

限制IOS中的应用程序功能仅适用于Cell / WiFi数据。

[英]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. 根据文档,仅设置此标志可确保设备尝试打开W​​i-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.

相关问题 在网络从wifi切换到移动数据期间,VPN正在停止。 在iOS中以编程方式连接了VPN - VPN is stopping during network is switching from wifi to mobile data. VPN is connected programmatically in iOS 仅iPad Wifi所需的设备功能 - Required device capabilities for iPad Wifi only iOS UI测试失败,因为“应用程序未运行,无法获取辅助功能数据。 你有没有打电话 - 发射?“ - iOS UI Tests failing because “Application is not running, unable to get Accessibility data. Did you call -launch?” 将 iOS 应用程序限制为仅 wifi? - Restrict iOS app to wifi only? 了解iOS设备是否具有蜂窝数据功能 - Know if iOS device has cellular data capabilities iOS:是否有可能要求核心位置框架仅使用手机信号塔或仅使用WiFi或使用GPS天线来获取位置? - iOS: Is it possible to ask core location framework to fetch location using only cell tower or only WiFi or using GPS antennas? 蜂窝网络超过了Google Geocoding API限制,但wifi上没有超过 - Google Geocoding API limit exceeded on cell network, but not on wifi iOS RestKit +核心数据。 提取速度慢和核心数据错误 - iOS RestKit + Core Data. Fetching slow and Core Data error Json数据在WiFi上的蜂窝网络上被截断 - Json data truncated on cell network ok on wifi 仅通过Wifi iOS测试连接 - Test Connection over Wifi only iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM