![](/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.