简体   繁体   English

如何检测用户在iPhone上更改的无线连接?

[英]How to detect user changed wireless connection on iPhone?

I want to check the user whether using whether wifi/3G connect or not, how can I check this behavior? 我想检查用户是否使用wifi / 3G连接,如何检查此行为? thank you. 谢谢。

Use Apple's "Reachability" sample app. 使用Apple的“可到达性”示例应用程序。 It's become the code most used for determining network connectivity. 它已成为最常用于确定网络连接性的代码。

http://developer.apple.com/iphone/library/samplecode/Reachability/Introduction/Intro.html http://developer.apple.com/iphone/library/samplecode/Reachability/Introduction/Intro.html

You can check once at launch time for network access, or set yourself up as a notification consumer of network connection change messages. 您可以在启动时检查一次网络访问,或将自己设置为网络连接更改消息的通知使用者。

This is important these days because Apple will test your app in Airplane Mode, and if it requires network connections it can't get, but doesn't handle that nicely, they'll bounce your submission. 这几天很重要,因为Apple会在飞行模式下测试您的应用程序,如果它需要无法获得但无法很好处理的网络连接,则他们会退回您的提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM