ios CoreBluetooth[WARNING] Unknown error: 1309

ε祈祈猫儿з 提交于 2019-12-20 09:54:12

问题


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?


回答1:


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);
        }];



回答2:


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



来源:https://stackoverflow.com/questions/20380561/ios-corebluetoothwarning-unknown-error-1309

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!