【问题标题】:How can I check that iPhone's Bluetooth is connected to other device / accessories or not?如何检查 iPhone 的蓝牙是否连接到其他设备/配件?
【发布时间】:2016-10-24 12:16:11
【问题描述】:

我正在开发一个包含蓝牙连接配对的应用程序。所以我想知道蓝牙是否连接到其他设备或任何配件?

检查蓝牙是否在 iPhone 中配对?

【问题讨论】:

    标签: ios objective-c swift bluetooth


    【解决方案1】:

    您可以尝试使用CBCentralManager 将连接的蓝牙设备检索到您的设备。当你的蓝牙设备开启时(CBCentralManager status == CBCentralManagerStatePoweredOn),调用这个函数:

    func retrieveConnectedPeripherals(withServices serviceUUIDs: [CBUUID]) -> [CBPeripheral]
    

    它为您提供连接到您的 iPhone 的所有服务的 UUID 列表。

    参考:https://developer.apple.com/reference/corebluetooth/cbcentralmanager/1518924-retrieveconnectedperipherals

    【讨论】:

    • 好的,我试试。谢谢
    猜你喜欢
    • 2013-02-19
    • 1970-01-01
    • 2020-08-30
    • 1970-01-01
    • 1970-01-01
    • 2012-10-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多