Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open Location Services from iOS application for iOS 11 beta?

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), application goes into background but Setting page doesn't get opened.

like image 912
Shrikant Phadke Avatar asked Oct 29 '22 04:10

Shrikant Phadke


1 Answers

application goes into background but Setting page doesn't get opened.

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

I was trying to dig into the de-compiled code of Settings.app(Which is actually Preferences.app). Seems like it still uses the schemes above we tried to use, since I found the scheme strings in same form in de-compiled codes.

And it might be added sort of permission control in SpringBoard to manager that which process can open specific path in Settings properly.

Anyway, for now in iOS 11 I can only use

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

to open settings.

like image 161
phoenixxyang Avatar answered Nov 15 '22 05:11

phoenixxyang