How to programmatically open the WIFI settings in Objective-C on iOS 10

后端 未结 7 1077
失恋的感觉
失恋的感觉 2020-12-17 23:43

The following code works fine on iOS 9, see this post. But it doesn\'t work on iOS 10. How to open WIFI settings programmatically on iOS 10

[[UIApplication s         


        
7条回答
  •  隐瞒了意图╮
    2020-12-17 23:53

    The same exact code should work, but for iOS 10 you need to do some additional work by adding "prefs" to the URL Types:

    After selecting your target:

    • Navigate to "Info" tab.
    • After scrolling to bottom, you should see "URL Types" section.
    • Add a new one (by clicking on the plus button) and fill the "URL Schemes" with "prefs".

    It should be similar to this:

    Now, your code should works fine.

    UPDATE:

    If it -somehow- did not work as expected, you might want to follow this workaround.

    Hope that helped.

提交回复
热议问题