![](/img/trans.png)
[英]How to connect Android device to an iOS device over BLE (Bluetooth Low Energy)
[英]How to search and connect nearby bluetooth device classic (Not BLE) on iOS?
我需要通過藍牙設備在附近搜索那些經典的藍牙(藍牙2.1或更高版本)。 我進行了很多搜索,但只有圖書館和關於BLE的討論,任何指南都對我有很大幫助。
據我所知,除非不手動配對並連接它們,否則您將找不到它們。 為了發現已經配對和連接的對象,我使用以下方法:
import AVFoundation
func example() {
let session = AVAudioSession.sharedInstance()
do {
try session.setCategory(AVAudioSessionCategoryPlayAndRecord, with: AVAudioSessionCategoryOptions.allowBluetooth)
if let inputs = session.availableInputs { ... } //should contain bluetooth devices aswell
}
catch { print("Failed to set category") }
}
`
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.