標籤:
在iOS開發中,有時會有跳轉系統設定介面的需求,例如提示使用者開啟藍芽或者WIFI,提醒使用者開啟推送或者位置許可權等。在iOS6之後,第三方應用需要跳轉系統設定介面,需要在URL type中添加一個prefs值,如:
跳轉系統設定根目錄中的項目使用如下的方法:
_array = @[ @{@"系統設定":@"prefs:root=INTERNET_TETHERING"}, @{@"WIFI設定":@"prefs:root=WIFI"}, @{@"藍芽設定":@"prefs:root=Bluetooth"}, @{@"系統通知":@"prefs:root=NOTIFICATIONS_ID"}, @{@"通用設定":@"prefs:root=General"}, @{@"顯示設定":@"prefs:root=DISPLAY&BRIGHTNESS"}, @{@"壁紙設定":@"prefs:root=Wallpaper"}, @{@"聲音設定":@"prefs:root=Sounds"}, @{@"隱私權設定":@"prefs:root=privacy"}, @{@"APP Store":@"prefs:root=STORE"}, @{@"Notes":@"prefs:root=NOTES"}, @{@"Safari":@"prefs:root=Safari"}, @{@"Music":@"prefs:root=MUSIC"}, @{@"photo":@"prefs:root=Photos"} ]; NSURL * url = [NSURL URLWithString:[_array[index] allValues].firstObject]; [[UIApplication sharedApplication]openURL:url];
如果要跳轉第三方應用的設定介面中,使用prefs:root=boundleId的方式,boundleId是第三方應用的boundleId。
如果需要繼續向項目內層進行跳轉,可以通過添加path路徑的方式,如下:
_array = @[ @{@"關於本機":@"prefs:root=General&path=About"}, @{@"軟體升級":@"prefs:root=General&path=SOFTWARE_UPDATE_LINK"}, @{@"日期時間":@"prefs:root=General&path=DATE_AND_TIME"}, @{@"Accessibility":@"prefs:root=General&path=ACCESSIBILITY"}, @{@"鍵盤設定":@"prefs:root=General&path=Keyboard"}, @{@"VPN":@"prefs:root=General&path=VPN"}, @{@"壁紙設定":@"prefs:root=Wallpaper"}, @{@"聲音設定":@"prefs:root=Sounds"}, @{@"隱私權設定":@"prefs:root=privacy"}, @{@"APP Store":@"prefs:root=STORE"}, @{@"還原設定":@"prefs:root=General&path=Reset"}, @{@"應用通知":@"prefs:root=NOTIFICATIONS_ID&path=應用的boundleId"} ];
ios之應用內跳轉系統設定相關介面