Toggling AirPlane mode in iOS Programmatically(以编程方式在 iOS 中切换 AirPlane 模式)
问题描述
我想以编程方式在 iOS 中打开/关闭飞行模式.谷歌搜索后,我得到了以下一些链接,并关注了它们,
I want to on/off airplane mode in iOS programmatically. After googling, i got some of the following links, and followed them,
可达性飞行模式 (3G) 与 Wifi
使用私有框架:导入 RadioPreferences.h
检测 iPhone 是否处于飞行模式?
以上所有链接,告诉我使用 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 模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:以编程方式在 iOS 中切换 AirPlane 模式


基础教程推荐
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01