2015-10-15 108 views
2

我需要打開IOS9.0中的藍牙設置菜單。接下來打開設置菜單OK!打開IOS中的藍牙設置菜單

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!) 

,但我需要開設

UIApplication.sharedApplication().openURL(NSURL(string: "prefs:root=General&path=Bluetooth")!) 

試過藍牙設置菜單它不工作

任何人都可以幫我嗎?

+0

現在我知道該怎麼做了。這是必要的,包括信息 - URL類型 - URL方案 - 首選 –

回答

5

路易斯實際上找到了答案,但我一開始讀過它,因爲我沒有看到答案。

答: 轉到您的XCode項目,信息下 - > URL類型部分 - 在URL方案> 「首選項」

在IOS9:let url = NSURL(string: "prefs:root=Bluetooth")!

iOS8上:let url = NSURL(string: "prefs:root=General&path=Bluetooth")!

+0

這確實幫助我 –

+0

它的首選項:root =藍牙爲IOS 8.4至少 – wyu

-1

你無法在iOS 10中打開藍牙設置。

這是我的建議打開設置(swift 3)

let url = URL(string: UIApplicationOpenSettingsURLString)! 
UIApplication.shared.openURL(url)