简体   繁体   English

Xcode IOS 8.3 swift如何检查蓝牙是否已连接?

[英]Xcode IOS 8.3 swift how to check if bluetooth is connected?

Does anyone know a way to just check if Bluetooth is connected for iOS? 有没有人知道如何检查蓝牙是否已连接iOS? I'm just looking to check for connection, and not trying to connect. 我只是想检查连接,而不是尝试连接。

You would probably use CBCentralManager for that. 您可能会使用CBCentralManager You can use retrieveConnectedPeripheralsWithServices to get a list of things that are connected based on their service UUID. 您可以使用retrieveConnectedPeripheralsWithServices获取基于其服务UUID连接的事物的列表。 If all you want to know is if Bluetooth is on or off, examine the state property of a CBCentralManager instance to determine if it is powered on or off. 如果您只想知道蓝牙是打开还是关闭,请检查CBCentralManager实例的state属性,以确定它是打开还是关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM