This code allows to determine current bluetooth status:
CBCentralManager* testBluetooth = [[CBCentralManager alloc] initWithDelegate:nil queue: nil];
switch ([testBluetooth state]) {....}
But, when [[CBCentralManager alloc] init...] happens, system popups an alert to user, if bluetooth is off.
Is there any way to check bluetooth status without disturbing my users?
I got the following response from an apple developer : In iOS7, the CBCentralManagerOptionShowPowerAlertKey
option lets you disable this alert.
If you havea a CBCentralManager when you initialise it, you can use the method initWithDelegate:queue:options
Example:
In my .h file i have a CBCentralManager * manager
In .m file :
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], CBCentralManagerOptionShowPowerAlertKey, nil];
_manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:options];
[_manager scanForPeripheralsWithServices:nil options:nil];
With this code the warning no longer appears, I hope that helps !