I want to on/off airplane mode in iOS programmatically. After googling, i got some of the following links, and followed them,
Reachability airplane mode (3G) vs. Wifi
Using Private Framework: Importing RadioPreferences.h
Detect if iPhone is in Airplane mode?
All of the above links, tell me to use AppSupport.framework and using RadiosPreferences.h.
This is giving me the status about whether airPlane mode is on or off, But it doesn't make me to change the airplane mode.
Then i saw, this link, How to turn on/off airplane mode in IOS 5.1 using private API, that gives me the way for toggling airplane mode but it is using entitlements, which only works for jailbroken devices. Is there any way, to set Airplane mode programatically(can use private APIs but not entitlements).
Every single App Store app is sandboxed with entitlements.
What you are trying to achieve is simply not possible if you want to distribute your app in the App Store. Your App simply cannot get enough privileges to achieve anything remotely similar. You cannot set global settings that changes the behaviour of the system. Apple will never allow that.
At the best you can monitor the status of the network connectivity via reachability but this is pretty much it. Using private API = straight app rejection.
If you don't care about AppStore submission and if your device is jailbroken (up to iOS 7.0.4 are jailbreakable), then you can follow these steps in exact order to programatically turn on or off Airplane Mode. I am also attaching a sample project to make things easier.
Download (https://iosopendev.googlecode.com/files/iOSOpenDev-1.6-2.pkg) and install. This will install the necessary tools in order to directly install the app in the place where Apple's apps are located. This is needed so that you have a proper access and permission.
Install OpenSSH in your device using Cydia. Then follow this tutorial: (http://www.priyaontech.com/2012/01/ssh-into-your-jailbroken-idevice-without-a-password/) to enable access without password (Using SSH key).
Download the sample project I created from here: (https://www.dropbox.com/s/c0i76vmtfckvsut/ToggleAirplane.zip) This project uses the same entitlements as SpringBoard app (App that controls home screen) of Apple. So you will have access to every setting. You will only need to know how to call it programatically.
In build settings go to "User Defined" section and edit the value for key iOSOpenDevDevice to the IP address of your device.
Now most awesome part. Press Command + Shift + I. This will install and respring your device.
However you may not see the app. To see it, download the Respring app from Cydia. When you launch it, it will respring the device. You should be able to see the app "ToggleAirplane" on your home screen.
Note: You won't be able to delete it from home screen just like you cannot do with Apple's apps. To delete it, you will need to go to Cydia->Packages. Fine the app and uninstall.