I know this question has been asked so many times. The answers say that this is not available in Xcode > 5.x. but I saw some apps that can use this(Go to Settings)(iOS7). Is there any way to do this? Is it available in Xcode 6? Facebook can detect both cellular data and wifi.
-
2Those are both system messages, not app messages. As of iOS 8 you can only launch your app's own settings page. – rmaddy Sep 23 '14 at 06:32
-
Is there a way so I can show those system messages? And in iOS8, can i switch on the device's wifi/cellular data ? – MaappeaL Sep 23 '14 at 06:50
5 Answers
As of iOS 8, it's possible to launch the Settings app that directly opens your Privacy app section in this way:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
In Swift:
if let settingsURL = NSURL(string: UIApplicationOpenSettingsURLString) {
UIApplication.sharedApplication().openURL(settingsURL)
}
In Swift 3.0:
if let settingsURL = URL(string: UIApplicationOpenSettingsURLString + Bundle.main.bundleIdentifier!) {
UIApplication.shared.openURL(settingsURL as URL)
}

- 5,465
- 6
- 39
- 70

- 9,944
- 4
- 30
- 43
-
7Does anyone know how to open just Settings app not individual settings? Facebook does it. – Pei Jan 29 '15 at 16:53
-
7@Pei Specify your app's bundle id in the url scheme: `[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@BundleID", UIApplicationOpenSettingsURLString]]];` – Aleksander Azizi Jul 27 '15 at 23:08
-
1This is for swift code just in case you want: guard let bundleIdentifier: String = NSBundle.mainBundle().bundleIdentifier else { return } if let url = NSURL(string: UIApplicationOpenSettingsURLString + bundleIdentifier) { UIApplication.sharedApplication().openURL(url) } – ryutamaki Feb 11 '16 at 13:41
-
1@AleksanderAzizi Specifying the app's bundle ID in the URL scheme doesn't seem to make a difference. – shim Sep 15 '16 at 20:25
2.- Use:
Objective - C
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]];
Swift
UIApplication.sharedApplication().openURL(NSURL(string: "prefs:root=General")!)
3.- Other path find in this answer: iOS Launching Settings -> Restrictions URL Scheme
-
yup broken in iOS 10, did you guys find any solution for the same – iAviatorJose Feb 06 '17 at 12:20
-
2As stated in other answers, replace "prefs" with "App-Prefs" to make it work in iOS 10. – Alex Jun 30 '17 at 12:59
-
1
-
My App got rejected for using this. Considering using UIApplicationOpenSettingsURLString instead but doesn't redirect to where i want it to. – sam k Jul 20 '18 at 19:22
This is not possible anymore in iOS 11, we can just open Settings. Here a Swift 4 code snippet:
if let url = URL(string:UIApplicationOpenSettingsURLString) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
iOS 13, Swift 5.0
Syntax for open settings changed [again] a tiny bit.
if let url = URL(string:UIApplication.openSettingsURLString) {
if UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}

- 8,587
- 7
- 46
- 87
Alerts on your screenshots are system alerts. The first occurs when app wants to use internet and have a blocked cellular data for application (and Wifi is not connected). The second occurs when an application wants to use location services, and you have turned off wifi. It is not possible control the display of these alerts.
In iOS 8 (Xcode 6) is the ability to open the settings directly from the application. Please read this topics: How to open Settings programmatically like in Facebook app?
-
how can I show the first one ? like, if i tried to open url from my webview it means that I need to use the internet, will the alert show? can you give me an example ? – MaappeaL Sep 23 '14 at 07:41
-
Close your app. Turn off wifi. Go to settings->cellular -> in section "Use cellular data for:" find your app and disable it. Open your app. – pawel_d Sep 23 '14 at 07:47
-
if you download an app from apple store and the app is required to use the internet, is it automatically added to the list of apps that uses cellular data? My app is does not appear on the list, is it normal because it is just a testing ? – MaappeaL Sep 23 '14 at 08:46
-
I do not know if there is any flag indicating that this app requires internet access. I did a simple test. I created project with single view application and in AppDelegate didFinishLaunchingWithOptions added Line: [NSURLConnection sendSynchronousRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.facebook.com"]] returningResponse:nil error:nil]; Turn wifi off and launch app. After that app appears on the list. – pawel_d Sep 23 '14 at 09:03