iosobjective-ciphoneairplane-mode

How can i know airplane mode on or off in ios


i would like to check airplane mode on or off on boolean variable. for example :

Bool airplaneMode = airplanemode;

if(airplaneMode)
{
     NSLoag(@"Airplane mode on");
}
else
{
    NSLoag(@"Airplane mode Off");
}

i don't want to check Network is available or not i need only to check airplane mode on or off.


Solution

  • AFAIK, there is no built-in api to determine if Airplane mode is on. You have to check if the respective services are available, depending on what you need in your app.

    For example, if you need a GPS location, you could check if a GPS location is available and then handle your different cases. Same for a network connection and all the other services that are disabled when airplane mode is on.

    Rechability is one example for checking network connection.