In iOS development, sometimes it involves jumping to the interface set by the system, such as turning on Bluetooth, notification, etc. No more nonsense, just above: Demo gives 31 jumps of the interface, of course you can also jump to other pages according to the rules reflected in the third step below ~
Step 1: Configure info information, add the URL Sechmes field as prefs, there is no jump without configuration!
Step 2: The code above shows all the jump pages covered by this Demo
let listArr = ["Wireless LAN","Bluetooth","Personal hot spots","Operators","notice","sleep","currency","Adjust brightness","wallpaper", "voice","siri Voice assistant","Privacy","Telephone","icloud","iTunes Strore and APP Store","safari","About this machine", "Software Updates","Accessibility","Date and time","keyboard","storage space","Language and Region","VPN","Description File and Device Management","Music", "Memorandum","Photos and Cameras","reduction","Twiter","Facebook"]
-
1. Jump Functions
//Jump System Settings Page func jump(url:String?){ guard let jumpUrl = URL.init(string: url!) else { return } if UIApplication.shared.canOpenURL(jumpUrl) { if #available(iOS 10.0, *){ UIApplication.shared.open(jumpUrl, options: [:], completionHandler: { (success) in if success { print("Jump Successful") } }) }else{ UIApplication.shared.openURL(jumpUrl) } } }
-2. Jump Settings: Note that the following are private API s, use with caution
//MARK: --Select the action to be performed by each cell public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { switch indexPath.row { case 0://Wireless LAN jump(url: "App-prefs:root=WIFI") case 1: //Bluetooth jump(url: "App-Prefs:root=Bluetooth") case 2: //Personal hot spots jump(url: "App-prefs:root=INTERNET_TETHERING") case 3: //Operators jump(url: "App-prefs:root=Carrier") case 4: //Notice: capitalization followed by ID is required jump(url: "App-prefs:root=NOTIFICATIONS_ID") case 5: //sleep jump(url: "App-prefs:root=DO_NOT_DISTURB") case 6: //currency jump(url: "App-prefs:root=General") case 7: //Adjust brightness jump(url: "App-prefs:root=DISPLAY&BRIGHTNESS") case 8://wallpaper jump(url: "App-prefs:root=Wallpaper") case 9://voice jump(url: "App-prefs:root=Sounds") case 10://siri Voice Assistant jump(url: "App-prefs:root=SIRI") case 11://Privacy jump(url: "App-prefs:root=Privacy") case 12: //Telephone jump(url: "App-prefs:root=Phone") case 13: //icloud jump(url: "App-prefs:root=CASTLE") case 14://iTunes Strore and APP Store jump(url: "App-prefs:root=STORE") case 15://safari jump(url: "App-prefs:root=SAFARI") case 16: //About this machine jump(url: "App-prefs:root=General&path=About") case 17://Software Updates jump(url: "App-prefs:root=General&path=SOFTWARE_UPDATE_LINK") case 18: //Accessibility jump(url: "App-prefs:root=General&path=ACCESSIBILITY") case 19: //Date and time jump(url: "App-prefs:root=General&path=DATE_AND_TIME") case 20: //keyboard jump(url: "App-prefs:root=General&path=Keyboard") case 21://storage space jump(url: "App-prefs:root=CASTLE&path=STORAGE_AND_BACKUP") case 22: //Language and Region jump(url: "App-prefs:root=General&path=Language_AND_Region") case 23://VPN jump(url: "App-prefs:root=General&path=VPN") case 24://Description File and Device Management jump(url: "App-prefs:root=General&path=ManagedConfigurationList") case 25://Music jump(url: "App-prefs:root=MUSIC") case 26://Memorandum jump(url: "App-prefs:root=NOTES") case 27: //Photos and Cameras jump(url: "App-prefs:root=Photos") case 28://reduction jump(url: "App-prefs:root=General&path=Reset") case 29: //Twiter jump(url: "App-prefs:root=TWITTER") case 30: //Facebook jump(url: "App-prefs:root=FACEBOOK") default: break } }
Step 3: Extend
- 1. Let's look at these jump codes
case 0://Wireless LAN jump(url: "App-prefs:root=WIFI") case 1: //Bluetooth jump(url: "App-Prefs:root=Bluetooth") case 2: //Personal hot spots jump(url: "App-prefs:root=INTERNET_TETHERING") case 3: //Operators jump(url: "App-prefs:root=Carrier") case 4: //Notice: capitalization followed by ID is required jump(url: "App-prefs:root=NOTIFICATIONS_ID") case 5: //sleep jump(url: "App-prefs:root=DO_NOT_DISTURB") case 6: //currency jump(url: "App-prefs:root=General")
- 2. Let's see how we switched the phone language to the English settings interface - is it easy to find the rules?
Summary: basically all jumps (url:'App-Prefs:root=Bluetooth'), followed by the root equal sign by the English word, of course some long English words are connected with'', such as jump (url:'App-prefs:root=NOTIFICATIONS_ID'), or some are capitalized, such as SAFARI.You can try it yourself to see the connection ~Is it easy?According to this rule, there are also some interface settings that can be skipped by themselves, some of which are also skipped!
OC is also a line of code call:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"App-Prefs:root=Bluetooth"]];
Finally, attach the demo download address: https://git.oschina.net/Qinz_323/JumpDemo
Reference Source: http://stackoverflow.com/questions/9092142/ios-uialertview-button-to-go-to-setting-app
I'm Qinz, and I hope my article will help you.