Bluetooth privacy usage prompt displayed immediately upon initialization of CBManager classes

iOS 13 is requesting Bluetooth permission immediately upon central manager initialization. From the Bluetooth 2019 talk, the presenter illustrated in the didUpdateState method to check the authorization state and appropriately prompt the user (presumably the same way you would with CMPedometer--invoke a instance method). Is this behavior to expected in the GM seed? It is counter intuitive and doesn't conform to the pattern that other frameworks use for their authorization workflow.


This permission model seems to be incorrect, most other frameworks have a static method on the corresponding class to get authorization status. For example https://developer.apple.com/documentation/corelocation/cllocationmanager/1423523-authorizationstatus, https://developer.apple.com/documentation/coremotion/cmpedometer/2913743-authorizationstatus.


The API signature that has a "notRequested" state, will seemingly never be the case since the prompt happens upon first initialization NOT first usage. CMPedometer initialization does not initiate the privacy prompt, only calling a method to do work does. CLLocationManager has explicit methods to invoke the authorization modal.


If we don't have the class func to check authorization, and are dependent on an instance of CBCentralManager to have been initialized with a delegate, we can't design an elegant workflow to prompt the user at the appropriate time.

Accepted Reply

For closure, I had a feedback open for this and the result was in iOS 13.1 the instance property was moved to a class property!

Hope this helps any future viewers of this post.
https://developer.apple.com/documentation/corebluetooth/cbmanager/3377595-authorization

Replies

Encountered related crash on our app just after finishing our testing with iOS12. Have to update code and redo process again. 😟

This is also affecting me, however it may be an intentional design.


This way, you simply have no reason to create a CBCentralManager until you need it. If you need it, you create it, and the prompt shows. Effectively, creating a CBCentralManager is the permission prompt.

For closure, I had a feedback open for this and the result was in iOS 13.1 the instance property was moved to a class property!

Hope this helps any future viewers of this post.
https://developer.apple.com/documentation/corebluetooth/cbmanager/3377595-authorization