Search code examples
iosiphoneswiftlocation

How to Detect Airplane Mode/ Flight Mode in IOS Swift


I need to detect weather IPhone is in Airplane mode or Not, i have done much research and i found no direct way to achieve that . My App has the functionality of Calling a Number and When an Iphone has Airplane mode he can't call.

so I need to show him my custom Screen to Notify that Airplane mode is enable.

it will be good if any one can explain how we can achieve it in an effective way.


Solution

  • Here is another way to detect this mode like below,

    go Info.plist -> add this **Application uses Wi-Fi (Boolean) YES*

    To test: Kill your app -> turn on airplane mode -> open ur app: you should be able to see alert within the app.

    enter image description here