Je migre donc vers iOS10 mais j'ai aussi besoin de mon code pour fonctionner sur iOS9. J'utilise CoreBluetooth et CBCentralManagerDelegate. Je peux obtenir mon code pour iOS10 mais j'ai besoin de la solution de secours pour iOS9.CBCentralManager iOS10 et iOS9
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
}
}
}
Je reçois l'erreur:
Enum case 'unauthorized' is not a member of type 'CBManagerState'
Sur la ligne:
case CBCentralManagerState.unauthorized:
De même que pour .poweredOff et .poweredOn.
Des idées comment je peux le faire fonctionner dans les deux cas?
Vérifiez ce lien https://forums.developer.apple.com/thread/51222 – Sujit
J'ai essayé cela, mais je ne pouvais pas obtenir leur solution pour travailler soit – cjbatin