그래서 iOS10으로 이전 중이지만 iOS9에서 실행하려면 코드가 필요합니다. 나는 CoreBluetooth와 CBCentralManagerDelegate를 사용하고 있습니다. iOS10에서 작동하도록 코드를 만들 수 있지만 iOS9에서도 작동하도록 폴백이 필요합니다. 라인에CBCentralManager iOS10 및 iOS9
Enum case 'unauthorized' is not a member of type 'CBManagerState'
:
func centralManagerDidUpdateState(_ central: CBCentralManager) {
if #available(iOS 10.0, *) {
switch central.state{
case CBManagerState.unauthorized:
print("This app is not authorised to use Bluetooth low energy")
case CBManagerState.poweredOff:
print("Bluetooth is currently powered off.")
case CBManagerState.poweredOn:
print("Bluetooth is currently powered on and available to use.")
default:break
}
} else {
// Fallback on earlier versions
switch central.state{
case CBCentralManagerState.unauthorized:
print("This app is not authorised to use Bluetooth low energy")
case CBCentralManagerState.poweredOff:
print("Bluetooth is currently powered off.")
case CBCentralManagerState.poweredOn:
print("Bluetooth is currently powered on and available to use.")
default:break
}
}
}
나는 오류를 얻을
case CBCentralManagerState.unauthorized:
뿐만 아니라 .poweredOff 및 .poweredOn에 대한
.어떻게 두 가지 방법으로 작동시킬 수 있습니까?
확인이 링크 https://forums.developer.apple.com/thread/51222 – Sujit
나는이 시도하지만 난 할 수 없었다 그들의 솔루션을 어느 쪽이든 작동 시키려면 – cjbatin