CBPeripheralManager.authorizationStatus()
and CBPeripheralManagerAuthorizationStatus
are deprecated based on apple docs. What is the proper way of checking whether user has granted permission to use bluetooth in background now?
CBPeripheralManagerDelegate
has peripheralManagerDidUpdateState
but that never returns unauthorized
regardless of whether user granted the permission or not, instead it only returns poweredOn
or poweredOff
CBCentralManager
and CBPeripheralManager
inherit from CBManager
.
As of iOS 13, CBManager
has an authorization
property. You can check this for .allowedAlways
.
You can use if #available(iOS 13.0, *)
to conditionally use authorization
on iOS 13 and later
Please note that Apple changed the CBManager
API between 13.0 and 13.1
authorization
is an instance property. authorization
is a type (class) property. The 13.0 instance property has been marked as deprecated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With