I want to check the use开发者_JAVA百科r whether using whether wifi/3G connect or not, how can I check this behavior? thank you.
Use Apple's "Reachability" sample app. It's become the code most used for determining network connectivity.
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.
精彩评论