kontaktio / kontakt-ios-sdk

This SDK makes it easy for you to configure, monitor, and securely update Kontakt.io Beacons through our Kontakt.io API.
http://developer.kontakt.io
Other
48 stars 9 forks source link

KTKEddystoneManager centralState is always "unknown" (0) #73

Open nashfive opened 5 years ago

nashfive commented 5 years ago

I followed the tutorial for the iOS integration for EddyStone with the SDK v2.0.1.


// somewhere in a view controller
KTKEddystoneManager *edsm = [[KTKEddystoneManager alloc] initWithDelegate:self];

if (edsm.centralState == CBCentralManagerStatePoweredOn) {
    [edsm startEddystoneDiscoveryInRegion:nil];
}
else {
    NSLog(@"Bluetooth is not powered on (%li)", edsm.centralState);
}

I also did it manually using a pure CBCentralManager and it works fine.

Your implementation feels wrong, since the status is not available right after the creation of the manager. I suspect that you forgot to rely on a CBCentralManagerDelegate call when the status has been updated:

- (void)centralManagerDidUpdateState:(CBCentralManager *)central {
    NSLog(@"central state: %li", central.state); // prints 5 (powered on)
   // Call a delegate to notify about the new central state
}
cjd1884 commented 3 years ago

Any updates on this? @nashfive Did you, somehow, managed to get a different centralState? Keep getting 0 here. Core Bluetooth manager (CBCentralManager) state is 5 (poweredOn).