ios CoreBluetooth [警告]未知错误:1309 [英] ios CoreBluetooth[WARNING] Unknown error: 1309

查看:241
本文介绍了ios CoreBluetooth [警告]未知错误:1309的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行正在开发的BlueTooth应用程序时偶尔会在控制台上收到消息CoreBluetooth [WARNING] Unknown error:1309。即使消息指出它是警告,它也会停止执行应用程序.I已经能够通过关闭蓝牙设置然后再打开来解决这个问题。任何人都可以告诉我是什么导致这个以及我应该做些什么来避免它?

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?

推荐答案

这是一个已知的问题,它是由于CoreBluetooth(苹果公司的bug)死机引起的,
1309错误主要出现在你的应用程序作为中央和外围设备运行时,以及操作相互重叠,在这种情况下会产生死锁(可以通过重启设备解决)。

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).

似乎BLE堆栈在其他一些情况下也会被破坏(iOS 7及更低版本,在iOS 7.1堆栈上更稳定,并且没有这样的问题。

我们如何解决这样的问题?

显示用户可以自行解决问题的故障排除屏幕。

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.

您可以在此找到已知的iOS问题 http://help.getpebble.com/customer/portal/articles/957568-troubleshooting#Pair

You can find known iOS issues here http://help.getpebble.com/customer/portal/articles/957568-troubleshooting#Pair

无论如何,我认为你可以开始使用 https: //github.com/l0gg3r/LGBluetooth 这将减少你身边有错误的机会,让你的工作更加有效。

以下是读/写实例

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

读取

[LGUtils readDataFromCharactUUID:@"f045"
                     serviceUUID:@"5ec0"
                      peripheral:peripheral
                      completion:^(NSData *data, NSError *error) {
                          NSLog(@"Data : %s Error : %@", (char *)[data bytes], error);
                      }];

int8_t dataToWrite = 0xFF;
[LGUtils writeData:[NSData dataWithBytes:&dataToWrite length:sizeof(dataToWrite)]
       charactUUID:@"cef9"
       serviceUUID:@"5ec0"
        peripheral:peripheral 
        completion:^(NSError *error) {
            NSLog(@"Error : %@", error);
        }];

这篇关于ios CoreBluetooth [警告]未知错误:1309的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆