Jignesh Patel
Jignesh Patel

Reputation: 755

Open Setting App from my applicaiton in iPhone iOS 7

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.

Upvotes: 1

Views: 8241

Answers (4)

Faisal Alneela
Faisal Alneela

Reputation: 216

Swift 4

let url = URL(string: UIApplicationOpenSettingsURLString)
    if UIApplication.shared.canOpenURL(url!) {
       UIApplication.shared.openURL(url!)
    }

Upvotes: 0

Husam
Husam

Reputation: 8568

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];

Upvotes: 2

Amol Prakash
Amol Prakash

Reputation: 257

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);

Upvotes: 0

Rushabh
Rushabh

Reputation: 3203

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

Here to Go.

Upvotes: 0

Related Questions