I am sporadically getting the message \"CoreBluetooth[WARNING] Unknown error: 1309” on the console when running a BlueTooth app I am developing. Even though the message states t
That's a known issue, It's caused due to deadlock in CoreBluetooth (Apple's bug), 1309 error is mostly appears when your app operates as a Central and Peripheral, and when the operations are overlapping each other, in that case deadlock will be produced (which can be resolved by rebooting device).
Seems BLE stack gets corrupted in some other cases too (iOS 7 and lower), on iOS 7.1 stack is much more stable, and doesn't have issues like this.
How we resolve issues like this?
Showing troubleshoot screen where user can fix problem himself/herself.
You can find known iOS issues here http://help.getpebble.com/customer/portal/articles/957568-troubleshooting#Pair
Anyway I think you can start using https://github.com/l0gg3r/LGBluetooth which will reduce chance having bugs on your side, and make your job much more effective.
Here are read/write examples
Read
[LGUtils readDataFromCharactUUID:@"f045"
serviceUUID:@"5ec0"
peripheral:peripheral
completion:^(NSData *data, NSError *error) {
NSLog(@"Data : %s Error : %@", (char *)[data bytes], error);
}];
Write
int8_t dataToWrite = 0xFF;
[LGUtils writeData:[NSData dataWithBytes:&dataToWrite length:sizeof(dataToWrite)]
charactUUID:@"cef9"
serviceUUID:@"5ec0"
peripheral:peripheral
completion:^(NSError *error) {
NSLog(@"Error : %@", error);
}];