有時候我們需要跳轉到藍牙設置頁面,而且跟隨系統的變化而變化,需要加版本判斷,下面是用到的方法
if (@available(iOS 11.0, *))
{
NSURL *url= [NSURL URLWithString:@"App-Prefs:root=General&path=Bluetooth"];
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
}else{
NSURL *url = [NSURL URLWithString:@"App-Prefs:root=Bluetooth"];
if ([[UIApplication sharedApplication]canOpenURL:url]) {
[[UIApplication sharedApplication]openURL:url];
}
}