Open Wifi Settings by “prefs:root=WIFI” failed in iOS 10

后端 未结 7 1385
太阳男子
太阳男子 2020-12-09 09:18

I was using prefs:root=WIFI url scheme in my app with prefs entered in info.plist to open directly the iOS settings application in Wi-Fi settings and it was working great on

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-09 10:06

    This works fine on iOS 10,

    Go to Targets --> (Application) --> Info --> URL Types --> +

    In the URL Schemes write

    prefs

    Then Call,

    - (void)openWifiSettings
    {
        if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"prefs:root=WIFI"]]) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];
        } else {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=WIFI"]];
        }
    }
    

提交回复
热议问题