Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios CoreBluetooth[WARNING] Unknown error: 1309

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 that it is a warning, it stops execution of the app. I have been able to work around this problem by turning the Bluetooth setting off and then back on. Can anyone tell me what is causing this and what I should do to avoid it?

like image 748
James Lin Avatar asked Dec 04 '13 16:12

James Lin


2 Answers

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);
        }];
like image 158
l0gg3r Avatar answered Oct 19 '22 09:10

l0gg3r


Since the CoreBluetooth is issuing this “warning”, there has to be someone at Apple or in the Bluetooth community who wrote the code or at least knows what situation is triggering the message. Can anyone tell me what is causing this and what I should do to avoid it, or point me to some material that will help me in this endeavor?

If I had to hazard a guess, I’d say that the primary reason you haven’t received much of a response is because you’ve given no description of your issue beyond “sometimes I see error 1309 and things stop working”.

If you haven’t already, please file a bug on bugreporter.apple.com and include as much detail as possible - a description of what you’re trying to do, repro steps that lead to the issue, even a test app. Respond to me directly with the bug number, and I will follow-up

like image 27
bLacK hoLE Avatar answered Oct 19 '22 08:10

bLacK hoLE