Code, Code, Revolution!
I just got my (fist) app rejected for App Store by Apple because it relies heavily on the internet connection being available and I didn’t have an information screen about the iPhone being in flight mode so the application wouldn’t do much. In my opinion only an idiot wouldn’t understand that an internet application wasn’t going to work with everything shut down but fair enough, i started hunting for code to detect flight mode.
Of course the developer pages Apple provide doesn’t give any hints. There’s an example on how to check which type of connection was available and that way I did implement an alert informing the user that they had to disable flight mode. But I couldn’t find a way to make the alert as sexy as Safari, with a button to open settings directly in the alert. It reads: “Turn off Airplane Mode or use Wi-Fi to access data”. After lots of searching Google I found out that to get the sexy Safari style alert you don’t need to write any code at all! It’s as simple as adding a property named “SBUsesNetwork” in the plist file for my app and the alert comes up automatically when the application launches. Here’s a screenshot of the plist setting:

It should be of type Boolean.
With this blog I try to provide useful tips and solutions for programming .NET, Objective-C and more. My name is Björn Sållarp, and I love writing code.
Christopher Price
July 3rd, 2009 at 10:32 pm
Apple seems to be wise to this, it doesn’t work for approval anymore. The SBUsesNetwork code only applies if Airplane Mode is turned on.
It does not apply if you are on an iPod touch with Wi-Fi off, or on an iPhone with no cellular signal.
The only sample code apple applies is their “Reachability” demo app. It’s up to you to implement the code to error prompt when internet is/isn’t available.
If your app is already approved, Apple appears to be letting some get a pass on not adding the code… but if your app isn’t approved yet… this isn’t enough anymore.
Brian Egge
October 14th, 2009 at 9:18 pm
Thanks. I had an app which uses MapKit, and was initially rejected due to the network issue. I added the SBUsesNetwork flag, and it was approved Sept 16. I then submitted a Pro version of the app, and it was rejected today.
John Stratoudakis
November 26th, 2009 at 8:01 am
I’m working on an app, and this option still helps because now my app is cool because it warns about “Airplane Mode”, and because I now have less work to do, mainly in dealing with the situations where the WWAN is not working, and when WiFi is working, but not able to reach my target host. So I am now reading about the UIAlertView class.
Thanks for posting this.