问题描述
我想以编程方式在 iOS 中打开/关闭飞行模式.谷歌搜索后,我得到了以下一些链接,并关注了它们,
I want to on/off airplane mode in iOS programmatically. After googling, i got some of the following links, and followed them,
以上所有链接,告诉我使用 AppSupport.framework 和 RadiosPreferences.h.这给了我关于 airPlane 模式是打开还是关闭的状态,但这并没有让我改变飞行模式.
All of the above links, tell me to use AppSupport.framework and using RadiosPreferences.h.This is giving me the status about whether airPlane mode is on or off, But it doesn't make me to change the airplane mode.
然后我看到了这个链接,如何使用私有 API 在 IOS 5.1 中打开/关闭飞行模式,这为我提供了切换飞行模式的方法,但它使用的是权利,仅适用于越狱设备.有没有办法以编程方式设置飞行模式(可以使用私有 API,但不能使用权利).
Then i saw, this link, How to turn on/off airplane mode in IOS 5.1 using private API, that gives me the way for toggling airplane mode but it is using entitlements, which only works for jailbroken devices. Is there any way, to set Airplane mode programatically(can use private APIs but not entitlements).
推荐答案
每个 App Store 应用程序都被沙盒化并带有权利.
Every single App Store app is sandboxed with entitlements.
如果您想在 App Store 中分发您的应用程序,那么您想要实现的目标根本不可能.您的应用程序根本无法获得足够的权限来实现远程类似的任何事情.您无法设置更改系统行为的全局设置.Apple 绝不允许这样做.
What you are trying to achieve is simply not possible if you want to distribute your app in the App Store. Your App simply cannot get enough privileges to achieve anything remotely similar. You cannot set global settings that changes the behaviour of the system. Apple will never allow that.
您最多可以通过可达性监控网络连接的状态,但仅此而已.使用私有 API = 直接应用拒绝.
At the best you can monitor the status of the network connectivity via reachability but this is pretty much it. Using private API = straight app rejection.
这篇关于以编程方式在 iOS 中切换 AirPlane 模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!