What causes CBCentralManagerStateUnknown in iOS?

后端 未结 6 2708
灰色年华
灰色年华 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:01

    In my case I did use AppDelegate as delegate for

    CBCentralManagerDelegate
    

    and indirectional for

     AVCaptureMetadataOutputObjectsDelegate.
    

    in one time.

    1) Take care about threads. Use

    dispatch_get_main_queue() 
    

    or

    [NSThread mainThread]
    

    for work with BLE.

    2) Take care about using this 2 delegates on 1 object. Because hardware is NOT thead and context save

提交回复
热议问题