检测 iPhone 是否处于飞行模式?
我需要一种方法来检测 iPhone 是否处于飞行模式,我做了一些研究并发现:
哪个不起作用,我也知道我可以设置 SBUsersNetwork 在飞行模式下显示警报,但它会要求用户打开 WIFI 但我的应用程序需要用户使用3G 和 WIFI 根本不起作用,那么在 CoreTelephony 中有什么直接的方法可以让我完成我的工作吗?
谢谢!
I need a way to detect if the iPhone is in Airplane Mode or not, I did some research and found:
iphone how to check the Airplane mode?
Which does not work, also I know I can set SBUsersNetwork to show an alert when in airplane mode, but it will ask user to switch on WIFI but my app need user to use 3G and WIFI simply does not work, so is there any straight forward way, in CoreTelephony that I can do my job?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
基本上:没有。你不能这样做。您可以做的是使用 Apple 的 Reachability 示例来检测如果网络连接可用。
Basically: no. You cannot do this. What you can do is use the Reachability samples from Apple to detect if a network connection is available.
使用公共 API 无法完成此操作。
在 IOS 5.1 中,您可以使用未记录的私有 API 执行以下操作。这不是苹果推荐的,也不能运送到应用商店。
将以下内容复制粘贴到 RadioPreferences.h
然后尝试如下。
It cannot be done using public API's.
In IOS 5.1, you can do as follows using undocumented private API's. This is not recommended by apple and cannot be shipped to app store.
Copy paste the below contents into RadioPreferences.h
Then try as below.