I have an application (I am not going to submit this app to apple app store) using which I want to check whether bluetooth is turned on. If it is turned on then I have to display an alert.
- (void)centralManagerDidUpdateState:(CBCentralManager *)central{
switch (central.state) {
case CBCentralManagerStatePoweredOn:{
//alert view
break;
}
}
And in viewdidload
I did like this
CBCentralManager * manager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];
but this is not working in ipad2 with ios 5.1.
the problem is
central.state
is always null.
I want the same scenario to work from ios 3.0 to ios 6 beta. Is there any common code for checking bluetooth state.
Any possible code is welcome, even code with private api.