是否有 API 可让我判断运行我的应用程序的 Apple 设备 (iPad/iPod/iPhone) 是否支持低功耗蓝牙 (BTLE)。
最佳答案
假设您有一个 iOS5 或 iOS6 设备并且您有一个 CBCentralManager 对象,您可以使用以下方法检查它的 CBCentralManagerState:
switch ([_manager state])
{
case CBCentralManagerStateUnsupported:
state = @"This device does not support Bluetooth Low Energy.";
break;
case CBCentralManagerStateUnauthorized:
state = @"This app is not authorized to use Bluetooth Low Energy.";
break;
case CBCentralManagerStatePoweredOff:
state = @"Bluetooth on this device is currently powered off.";
break;
case CBCentralManagerStateResetting:
state = @"The BLE Manager is resetting; a state update is pending.";
break;
case CBCentralManagerStatePoweredOn:
state = @"Bluetooth LE is turned on and ready for communication.";
break;
case CBCentralManagerStateUnknown:
state = @"The state of the BLE Manager is unknown.";
break;
default:
state = @"The state of the BLE Manager is unknown.";
}
您还需要监视 centralManagerDidUpdateState:central
委托(delegate)更新,然后在您的应用中采取适当的操作。
关于ios - 如何检测我的苹果设备是否支持低功耗蓝牙,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13585218/