Before upgrading to iOS6, it all worked fine, but now when I run

[centralManager cancelPeripheralConnection:peripheral];

the callback gets triggered

-(void) centralManager:(CBCentralManager *)central didDisconnectPeripheral:(CBPeripheral     *)peripheral error:(NSError *)error{
NSLog(@"Disconnected");
NSLog(@"Error: %@", [error localizedDescription]);
}

and the console outputs

Disconnected
Error: (null)

Still, the peripheral isn't disconnected until I either turn of bluetooth in settings or turn of the phone (I have a connected status on the peripheral). Has anyone else discovered this iOS6 specific problem?

有帮助吗?

解决方案

I believe this is a feature (if you would like to call it that) of iOS6.

It's just a way of not disrupting other applications that might use the connection (or it might be in the middle of a pairing procedure). It may take up to 45 seconds before it is disconnected.

If possible the best solution might be to trigger the disconnect from the peripheral, then the disconnect would happen straight away.

http://lists.apple.com/archives/bluetooth-dev/2012/Sep/msg00090.html

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top