In iOS development, sometimes there is a need to jump system setup interface, such as prompting the user to open the alert user to open the push or location permissions.
After IOS6, the third-party app needs to jump to the system Setup interface and need to add a prefs value to the URL type, such as:
Note: There are three ways to set up jumps, each with a different usage scenario. And when you jump to the system and apply the settings below,
Your app needs to have at least one permission in advance, such as notification, location, etc. Otherwise, it can cause a crash.
- Mode one: prefs:root= a service
- Way two: Prefs:root=bundleid
- Way three: Uiapplicationopensettingsurlstring
The following specific jump implementation:
- Jump method:
10.0*url= [nsurl urlwithstring:@ "prefs:root=location_services"]; if 10.0 if([[uiapplication Sharedapplication]canopenurl:url]) {[[ UIApplication sharedapplication]openurl:url options:@{}completionhandler:^(BOOL success) {}];}
2. Jump to the specific location: (different ways to specify)
When iOS system version <= iOS7, you can only jump to the system settings page:
Example: Jump to: Privacy-location services. Nsurl *url= [Nsurl urlwithstring:@] Prefs:root=location_services
prefs:root= a service
System settings: prefs:root=internet_tethering WIFI settings: Prefs:root=wifi Bluetooth settings: Prefs:root=bluetooth system notification: prefs:root=notifications _ID Universal Settings: prefs:root=general display settings: prefs:root=display&brightness wallpaper settings: prefs:root=wallpaper Sound settings: prefs:root= Sounds privacy settings: prefs:root=privacy cellular: prefs:root=mobile_data_settings_id Music: Prefs:root=music
Album ":p Refs:root=photos
This way of jumping, is to jump to the system settings interface.
When iOS system version >= iOS8, support jump to third party app's settings interface
With Prefs:root=bundleid, Bundleid is the unique ID of your third-party app project
Limitations: Only support the IOS8,IOS9 system, on the IOS10 system, will not jump.
On the iOS7 system, just jump to the settings app, not recommended.
If you need to continue to jump to the inner layer of the project, you can add the path path by adding the following:
About this machine: prefs:root=general&path=about
Software Upgrade: Prefs:root=general&path=software_update_link
Date Time: Prefs:root=general&path=date_and_time
Accessibility:prefs:root=general&path=accessibility
Keyboard settings: Prefs:root=general&path=keyboard
Sound settings: prefs:root=sounds
Privacy settings: prefs:root=privacy
APP Store:prefs:root=store
Restore settings: Prefs:root=general&path=reset
App notifications: Boundleid for prefs:root=notifications_id&path= applications
Location: prefs:root=location_services
Cellular network: prefs:root=mobile_data_settings_id
Vpn-prefs:root=general&path=network/vpn
Wi-fi:prefs:root=wifi
Location Services: prefs:root=location_services
Personal hotspot: prefs:root=internet_tethering
Auxiliary function: prefs:root=general&path=accessibility
Flight mode: Prefs:root=airplane_mode
Lock: Prefs:root=general&path=autolock
Brightness: prefs:root=brightness
Bluetooth: Prefs:root=general&path=bluetooth
Settings: prefs:root=general
Network-prefs:root=general&path=network
Notes-prefs:root=notes
Photos-prefs:root=photos
Sounds-prefs:root=sounds
Software Update-prefs:root=general&path=software_update_link
Store-prefs:root=store
jump to System settings is not supported when iOS system version >= iOS8 support jump to your app settings.
Nsurl *url = [Nsurl urlwithstring:uiapplicationopensettingsurlstring];
uiapplicationopensettingsurlstring is provided on the IOS8, support IOS8,IOS9,IOS10 system, recommended use.
the Prefs:root=bundleid and prefs:root= services will not work.
Jump to the Phone system settings page in the IOS App