Turn off flight mode

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:

SBUsesNetwork plist setting
It should be of type Boolean.

Related posts