How to invoke “Turn Off Airplane Mode” notification

后端 未结 5 1648
南方客
南方客 2020-12-14 11:00

In many applications, such as the Mail app, if the device is in airplane mode a notification will pop up that says \"Turn Off Airplane Mode or Use Wi-Fi to Access Data.\"

相关标签:
5条回答
  • 2020-12-14 11:26

    If you want the standard Turn Off Airplane Mode or Use Wi-Fi to Access Data [settings | ok]

    1. Add a new property in your info.plist by clicking the + sign at the top.
    2. The new property is called UIRequiresPersistentWiFi (this is similar to postings above, but needs to be exact otherwise it doesn't register)
    3. Change type from String to Boolean
    4. Change value from NO to YES
    5. Clean and rebuild your app
    0 讨论(0)
  • 2020-12-14 11:33

    Take a look at this. Apparently, Airport control was moved by Apple into a separate framework

    It seems there is no standard way to notify the user to turn airplane mode back on. As you mentioned, this obviously isn't very elegant, so I assume apple deleted this feature.

    0 讨论(0)
  • 2020-12-14 11:35

    I test in my app. I find it changed. "UIRequiresPersistentWifi" => "Application uses Wi-Fi". I hope it will help somebody.

    0 讨论(0)
  • 2020-12-14 11:47

    You could use the apple's reachablity framework when you app launches to check for network connectivity. Check this out

    http://developer.apple.com/library/ios/#samplecode/Reachability/Introduction/Intro.html

    I have a wrapper class for reachbiltiy APIs to make it simpler to use. (ASIHTTPRequest has one as well).

    https://github.com/daltoniam/GPHTTPRequest

    see the GPReachablity class for checking for connectivity. As far as a dialog prompt, not sure there is a way to push to the settings app. Any questions let me know.

    0 讨论(0)
  • 2020-12-14 11:52

    If you add the UIRequiresPersistentWifi key to your Info.plist and set it to YES, then if you're in Airplane mode, you'll get the standard "Turn Off Airplane Mode..." popup on launch.

    0 讨论(0)
提交回复
热议问题