Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
291 views
in Technique[技术] by (71.8m points)

iphone - Access Settings app in iOS

Is there an opportinity to show up the settings.app in iOS by clicking on a button? It should work with iOS 5.1 so the "prefs:root..." url is no option.

Do you have an idea how to solve this?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I know the question is about 5.1 specifically, but in case anyone else is interested:

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.

UPDATE:

Thanks to Pavel's comment, I simplified the if statement and avoided the EXC_BAD_ACCESS on iOS 7.

UPDATE 2:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...