1

I want to open iphone default setting application form my application, Please any one tell me what I have to do. OR is there any code to open it.

I try following code but it dont works.in iOS 7.1.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=LOCATION_SERVICES_Systemservices"]];

Thanks in Advance.

Jignesh Patel
  • 755
  • 1
  • 8
  • 10

4 Answers4

2

For iOS8 and later use :

// Send the user to the Settings for this app
//iOS 8 only
NSURL *settingsURL = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:settingsURL];
Husam
  • 6,286
  • 3
  • 32
  • 36
0

Since iOS 5.1, there is no official way to open Settings via App.

Here to Go.

Community
  • 1
  • 1
Rushabh
  • 3,125
  • 4
  • 25
  • 49
0

You can use private API to open Settings App from your application. But i'm not sure if it will get accepted from apple.

void (*openApp)(CFStringRef, Boolean);
void *hndl = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", 0);
openApp = dlsym(hndl, "SBSLaunchApplicationWithIdentifier");
openApp(CFSTR("com.apple.Preferences"), FALSE);
Amol Prakash
  • 207
  • 2
  • 15
0

Swift 4

let url = URL(string: UIApplicationOpenSettingsURLString)
    if UIApplication.shared.canOpenURL(url!) {
       UIApplication.shared.openURL(url!)
    }
Faisal Alneela
  • 121
  • 2
  • 6