What causes CBCentralManagerStateUnknown in iOS?

后端 未结 6 2711
灰色年华
灰色年华 2021-02-20 06:15

Why do I get CBCentralManagerStateUnknown on an iPad 2 when using this simple code?

- (BOOL)viewDidLoad {

    bluetoothManager = [[CBCentralManager         


        
6条回答
  •  别跟我提以往
    2021-02-20 07:07

    You need to both retain the CBCentralManager instance (put it in an ivar or private property) and wait for the state change delegate to be called. (The state is always "unknown" if you check it immediately after instantiating the manager. The real state will appear momentarily in the delegate method.)

提交回复
热议问题