Is it possible to access the settings app from your own app via a button or whatever it may be in iOS 8. I heard that it got decrepitude in iOS 5, is that true? If not did the method change in iOS 8? If there is not other way to do this what would be the best way to work around it?
Asked
Active
Viewed 2.0k times
33
-
Duplicate: http://stackoverflow.com/questions/7328545/access-ios-settings-from-code and http://stackoverflow.com/questions/9664315/access-settings-app-in-ios – Vijay Tholpadi Jun 15 '14 at 15:30
4 Answers
65
As of iOS 8, it is possible to take a user from your app directly into the Settings app. They will be deep linked into your app's specific Settings page, but they can back out into the top level Settings screen.
If you're also supporting iOS 7 you'll need to check first if a specific string constant is present.
UPDATE:
If your deployment target is set to 8.0 or above, Xcode 6.3 will give you the following warning:
Comparison of address of 'UIApplicationOpenSettingsURLString' not equal to a null pointer is always true
This is because the feature was available starting in 8.0, so this pointer will never be NULL
. If your deployment target is 8.0+, just remove the if statement below.
if (&UIApplicationOpenSettingsURLString != NULL) {
NSURL *appSettings = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
[[UIApplication sharedApplication] openURL:appSettings];
}

djibouti33
- 12,102
- 9
- 83
- 116
-
2What does the `&` in front of the constant `UIApplicationOpenSettingsURLString` do? – John Erck Sep 24 '14 at 13:43
-
4It's seeing if a pointer exists for the UIApplicationOpenSettingsURLString constant. If you were to just test for the existence of the constant, it would fail. Testing for the existence of the pointer is safe. – djibouti33 Sep 24 '14 at 17:20
-
1This is useful functionality, but is there anyway for a user to then get back to your app quickly? – Thomas Clowes Nov 11 '14 at 17:38
-
@ThomasClowes, at that point the user is in the Settings app and you have no more control. They'd need to double tap the home button and select your app to get back. – djibouti33 Nov 11 '14 at 18:55
-
1Thanks. As I suspected. Its a bit annoying that you can help them get to the settings page but cannot help them get back. – Thomas Clowes Nov 12 '14 at 12:46
-
@djibouti33, isn't `if (&UIApplicationOpenSettingsURLString)` the same thing? – Iulian Onofrei Feb 13 '15 at 10:58
-
1@ThomasClowes In iOS 9 you now have the "Back to 'app'..." button in the top-left. – Canucklesandwich Mar 08 '16 at 23:12
18
Use UIApplicationOpenSettingsURLString
.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];

David Beck
- 10,099
- 5
- 51
- 88
-
-
1Note: Xcode will appear to crash when you change a setting,as the app force closes. It works fine on the device without Xcode connected. – Peter Johnson Jul 18 '16 at 13:47
13
In Swift:
if let settingsURL = NSURL(string: UIApplicationOpenSettingsURLString) {
UIApplication.sharedApplication().openURL(settingsURL)
}

zumzum
- 17,984
- 26
- 111
- 172

NatashaTheRobot
- 6,879
- 4
- 32
- 27
2
Swift 3 example:
if let url = URL(string: UIApplicationOpenSettingsURLString) {
UIApplication.shared.openURL(url)
}

Daniel Storm
- 18,301
- 9
- 84
- 152