首先聲明要使用到的URL scheme密末,這一步必須做握爷,在info->URL Types增加一種prefs,這里的prefs代表系統(tǒng)的設(shè)置严里,如果不添加這個新啼,是無論如何也跳不過去的,不管iOS的系統(tǒng)版本是什么刹碾,這里都是prefs燥撞。
以跳轉(zhuǎn)到設(shè)置App的消息通知為例:
iOS10之前:
NSString * idf = [NSBundle mainBundle].bundleIdentifier;
NSString * string = [NSString stringWithFormat:@"prefs:root=NOTIFICATIONS_ID&path=%@", idf];
NSURL * url = [NSURL URLWithString:string];
[[UIApplication sharedApplication] openURL:url];
iOS10之后:
NSString * idf = [NSBundle mainBundle].bundleIdentifier;
NSString * string = [NSString stringWithFormat:@"App-Prefs:root=NOTIFICATIONS_ID&path=%@", idf];
NSURL * url = [NSURL URLWithString:string];
[[UIApplication sharedApplication] openURL:url];
更多常用的URL:
iOS10之前:
prefs:root=Brightness //打開Brightness(亮度)設(shè)置界面
prefs:root=Bluetooth //打開藍(lán)牙設(shè)置
prefs:root=General&path=DATE_AND_TIME //日期與時間設(shè)置
prefs:root=General //打開通用設(shè)置
prefs:root=General&path=Keyboard //打開鍵盤設(shè)置
prefs:root=CASTLE //打開iClound設(shè)置
prefs:root=General&path=INTERNATIONAL //打開通用下的語言和地區(qū)設(shè)置
prefs:root=LOCATION_SERVICES //打開隱私下的定位服務(wù)
prefs:root=Photos //打開設(shè)置下照片和相機(jī)設(shè)置
prefs:root=Safari //打開設(shè)置下的safari設(shè)置
prefs:root=Sounds //打開設(shè)置下的聲音設(shè)置
prefs:root=Wallpaper //打開設(shè)置下的墻紙設(shè)置
prefs:root=WIFI //打開wifi設(shè)置
iOS10之后:
App-Prefs:root //設(shè)置頁面
App-Prefs:root=WIFI //無線局域網(wǎng)
App-Prefs:root=Bluetooth //藍(lán)牙
App-Prefs:root=MOBILE_DATA_SETTINGS_ID //蜂窩移動網(wǎng)絡(luò)
App-Prefs:root=NOTIFICATIONS_ID //通知
App-Prefs:root=General //通用
App-Prefs:root=General&path=About //通用-關(guān)于本機(jī)
App-Prefs:root=General&path=Keyboard //通用-鍵盤
App-Prefs:root=General&path=ACCESSIBILITY //通用-輔助功能
App-Prefs:root=General&path=INTERNATIONAL //通用-語言與地區(qū)
App-Prefs:root=SIRI //Siri
App-Prefs:root=Privacy //隱私
App-Prefs:root=SAFARI //Safari
App-Prefs:root=Photos //照片與相機(jī)