How to open location services from an iOS 11 beta app iOS 11?

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0)
{
     NSURL *URL = [NSURL URLWithString:@"App-prefs:root=Privacy&path=LOCATION"];
    [[UIApplication sharedApplication] openURL:URL options:@{} completionHandler:nil];           
}

This code works fine for iOS 10.0 to 10.3.3 but when I run this code for iOS 11 (beta), the application goes into the background, but the settings page does not open.

+4
source share
4 answers

The application goes into the background, but the settings page does not open.

It was a failure Settings.app. From iOS 11 Beta 7, a crash was fixed. But it still cannot open a specific path with a scheme like @ "App-Prefs: root = Privacy & path = LOCATION".

Settings.app( Preferences.app). , , , .

SpringBoard - , .

, iOS 11

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

.

+2

URL Info.plist,

- > - > - > URL- >

URL Schemes.

enter image description here

:

        NSURL *URL = [NSURL URLWithString:@"App-Prefs:root=Privacy&path=LOCATION"];
        [[UIApplication sharedApplication] openURL:URL options:@{} completionHandler:nil];

Xcode 9 beta 4 (iOS 11 beta).
, !

+1

, iOS URL-, . if([UIApplication sharedApplication] canOpenURL:URL]]){...}. iOS 11 , else, iOS 11 .

0

iOS, . - 10, . , .

0

Source: https://habr.com/ru/post/1683159/


All Articles