Open Settings app from another app programmatically in iPhone Open Settings app from another app programmatically in iPhone ios ios

Open Settings app from another app programmatically in iPhone


Good news :

You can open settings apps programmatically like this (works only from iOS8 onwards).

If you are using Swift 3.0:

UIApplication.shared.open(URL(string: UIApplicationOpenSettingsURLString)!)

If you are using Objective-C:

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

For other lower versions (less than iOS8) its not possible to programatically open the settings app.


As others answered, you cannot open the Settings from your app.

However You can solve the situation, like I have done:

Output a message that Location services must be enabled explaining why, and show the path in that message:

"Settings->Privacy->LocationServices"


Opening settings apps programmatically is possible only from iOS 8. So, use the following code...

if([CLLocationManager locationServicesEnabled]&&   [CLLocationManager authorizationStatus] != kCLAuthorizationStatusDenied){  //...Location service is enabled}else{    if([[[UIDevice currentDevice] systemVersion] floatValue] < 8.0)    {       UIAlertView* curr1=[[UIAlertView alloc] initWithTitle:@"This app does not have access to Location service" message:@"You can enable access in Settings->Privacy->Location->Location Services" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil];      [curr1 show];    }    else    {       UIAlertView* curr2=[[UIAlertView alloc] initWithTitle:@"This app does not have access to Location service" message:@"You can enable access in Settings->Privacy->Location->Location Services" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:@"Settings", nil];       curr2.tag=121;       [curr2 show];    }}- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{   if (alertView.tag == 121 && buttonIndex == 1) {  //code for opening settings app in iOS 8   [[UIApplication sharedApplication] openURL:[NSURL  URLWithString:UIApplicationOpenSettingsURLString]]; }}