Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ethana

macrumors 6502a
Original poster
Jul 17, 2008
836
0
Seattle, WA
My app just got denied approval from the App Store. Here is what Apple said:

"The application works fine when connected to the Internet, however, when no Internet access is available (for example, in Airplane Mode), the application crashes upon opening. Instead of closing by crashing, the application should handle the absence of network access with an error message. The crash logs are attached for your inspection."

How do I detect no internet and then throw an error message up? I have never done anything like that before. Some sample code would be nice. Thanks!

Ethan
 

robfarmer

macrumors newbie
Jul 26, 2008
20
0
Checking Connectivity

Good to know, error handling and connectivity was the last thing on my todo, makes me wonder how in depth Apple tests the apps.

The combination of the following two examples on the iPhone Dev site should help you:

The SeismicXML example has some code you could go through to test conenctivity to a specific domain:

http://developer.apple.com/iphone/library/samplecode/SeismicXML/listing7.html

That should see if a specific host is available.

The Reachability example will tell you if Wifi or cellular is available (not connected, but turned on):

http://developer.apple.com/iphone/l...ty/index.html#//apple_ref/doc/uid/DTS40007324
 

ethana

macrumors 6502a
Original poster
Jul 17, 2008
836
0
Seattle, WA
And what about popping a dialog to display "Sorry, no Internet".... whats the best way to do that?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.