使用Objective-C在iPhone上禁用WIFI [英] Disable WIFI on iPhone using Objective-C

查看:259
本文介绍了使用Objective-C在iPhone上禁用WIFI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在iPhone上使用Objective-C来禁用所有WIFI连接。我们的组织只希望通过小区连接发送数据,并且不希望手机能够加入任何WIFI网络。我们正在考虑编写一个应用程序,可以保持WIFI关闭或检测何时连接到网络然后断开连接。

解决方案

< blockquote>

是否可以在iPhone上使用Objective-C禁用所有WIFI连接?


Rant note :每个人都看到OP在询问是否可能?他没有提到API必须公开。所以这就是:

  Class _SBWifiManager = objc_getClass(SBWiFiManager); //从SpringBoard窃取一个类
[[_SBWifiManager sharedInstance] setWiFiEnabled:NO]; //禁用

参考



然而,必须注意嘲笑像这样的iOS内部肯定会导致您的应用被拒绝。但是,如果您不关心进入AppStore,并且您正在开发越狱或内部或个人应用程序,这应该没问题。



另外,我认为如果你需要这样的功能,你应该考虑重新设计你的app / code / logic。通常情况下,这不是必需的。


Is it possible using Objective-C on an iPhone to disable all WIFI connections. We have an organization that only wants data to be sent over the cell connection and doesn't want the phone able to join any WIFI networks. We are looking at writing an app that would either keep WIFI turned off or detect when it connects to a network and then disconnect it.

解决方案

Is it possible using Objective-C on an iPhone to disable all WIFI connections?

Rant note: everybody sees OP is asking if it's possible or not? He doesn't mention the API has to be public. So here it is:

Class _SBWifiManager = objc_getClass("SBWiFiManager"); // Steal a class from SpringBoard
[[_SBWifiManager sharedInstance] setWiFiEnabled:NO]; // disable

(reference)

However, it has to be noted well that mocking with the internals of iOS like this will for sure lead to the rejection of your app. However, if you don't care about getting into the AppStore, and you're developing a jailbroken or in-house or personal app, this should be just fine.

Also, I think you should consider redesigning your app/code/logic if you need such a functionality. This shall not be necessary, normally.

这篇关于使用Objective-C在iPhone上禁用WIFI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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