在iOS中以编程方式切换AirPlane模式 [英] Toggling AirPlane mode in iOS Programmatically

查看:257
本文介绍了在iOS中以编程方式切换AirPlane模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想以编程方式在iOS中开启/关闭飞行模式。 Google搜索结束后,我收到了以下链接,并跟踪了他们,

可达性飞机模式(3G)与Wifi 使用私有框架:导入RadioPreferences.h



检测iPhone是否处于飞行模式?



以上所有链接都告诉我使用AppSupport.framework并使用RadiosPreferences.h。
这给我关于飞机模式是打开还是关闭的状态,但它不会让我改变飞行模式。


然后我看到,这个链接,如何使用私有API在IOS 5.1中打开/关闭飞行模式,这使我可以切换飞行模式但它使用的权利只适用于越狱设备。有没有什么办法,以编程方式设置飞行模式(可以使用私有API,但不能授权)。

与权利一起被沙盒包装。

如果您想在App Store中分发您的应用程序,您试图实现的目标根本无法实现。您的应用程序根本无法获得足够的权限来实现任何类似的远程操作您无法设置改变系统行为的全局设置。苹果公司决不会允许这样做。



最好的情况是可以通过可达性来监控网络连接的状态,但这非常重要。使用私有API =直接应用拒绝。


I want to on/off airplane mode in iOS programmatically. After googling, i got some of the following links, and followed them,

Reachability airplane mode (3G) vs. Wifi

Using Private Framework: Importing RadioPreferences.h

Detect if iPhone is in Airplane mode?

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.

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).

解决方案

Every single App Store app is sandboxed with entitlements.

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.

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模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆