项目中经常需要我们去获取一些系统的权限,可是如果用户在刚开始的时候并没有允许一些要求,后期不做提示的话,可能只能去设置中一个个去找寻了,所以我们就需要常常去跳转设置页面去打开一些权限开关。这里就简单的介绍一下。
首先需要跳转方法:
ios10以前: [[UIApplication sharedApplication]openURL:@""];
ios10:[[UIApplication sharedApplication]openURL:@"" options:nil completionHandler:nil];
这个是需要做判断的,如果不判断可能就会崩溃。
然后就是在URL Schemes 添加 prefs的url
Paste_Image.png然后就是用上面的方法去跳转了:
Paste_Image.png以前就是枚举的设置的一些关键字:
About — prefs:root=General&path=About
Accessibility — prefs:root=General&path=ACCESSIBILITY
AirplaneModeOn— prefs:root=AIRPLANE_MODE
Auto-Lock — prefs:root=General&path=AUTOLOCK
Brightness — prefs:root=Brightness
Bluetooth — prefs:root=General&path=Bluetooth
Date& Time — prefs:root=General&path=DATE_AND_TIME
FaceTime — prefs:root=FACETIME
General— prefs:root=General
Keyboard — prefs:root=General&path=Keyboard
iCloud — prefs:root=CASTLE iCloud
Storage & Backup — prefs:root=CASTLE&path=STORAGE_AND_BACKUP
International — prefs:root=General&path=INTERNATIONAL
Location Services — prefs:root=LOCATION_SERVICES
Music — prefs:root=MUSIC
Music Equalizer — prefs:root=MUSIC&path=EQ
Music VolumeLimit— prefs:root=MUSIC&path=VolumeLimit
Network — prefs:root=General&path=Network
Nike + iPod — prefs:root=NIKE_PLUS_IPOD
Notes — prefs:root=NOTES
Notification — prefs:root=NOTIFICATIONS_ID
Phone — prefs:root=Phone
Photos — prefs:root=Photos
Profile — prefs:root=General&path=ManagedConfigurationList
Reset — prefs:root=General&path=Reset
Safari — prefs:root=Safari Siri — prefs:root=General&path=Assistant
Sounds — prefs:root=Sounds
SoftwareUpdate— prefs:root=General&path=SOFTWARE_UPDATE_LINK
Store — prefs:root=STORE
Twitter — prefs:root=TWITTER
Usage — prefs:root=General&path=USAGE
VPN — prefs:root=General&path=Network/VPN
Wallpaper — prefs:root=Wallpaper
Wi-Fi — prefs:root=WIFI
Setting—prefs:root=INTERNET_TETHERING
网友评论