當我嘗試連接藍牙設備時,它反覆無法連接並顯示錯誤CoreBluetooth[WARNING] Unknown error: 311
。我正在使用2個iPod 5 Touch設備。CoreBluetooth [警告]未知錯誤:311使用iOS中的CoreBluetooth Framework反覆連接和斷開連接時發生
2
A
回答
7
我已經運行到這個也是一樣,它似乎是在藍牙核心的XPC通信的錯誤:
2013-03-22 14:49:24.652 Buggy[985:907] Connecting to peripheral <CBConcretePeripheral: 0x1dd4e150 UUID = (null), Name = "iPhone 5 #003014", IsConnected = NO>
2013-03-22 14:49:24.659 Buggy[985:907] CoreBluetooth[WARNING] Unknown error: 311
2013-03-22 14:49:24.661 Buggy[985:907] Failed to connect to peripheral <CBConcretePeripheral: 0x1dd4e150 UUID = (null), Name = "iPhone 5 #003014", IsConnected = NO>
2013-03-22 14:49:24.689 Buggy[985:907] Discovered peripheral <CBConcretePeripheral: 0x1dd644d0 UUID = (null), Name = "iPhone 5 #003014", IsConnected = NO> with advertisement data {
kCBAdvDataLocalName = "iPhone 5 #003014";
kCBAdvDataServiceUUIDs = (
"Unknown (<b2e74c08 96094371 a8f0978c 655700ea>)"
);
}, RSSI: -50
2013-03-22 14:49:24.692 Buggy[985:907] Connecting to peripheral <CBConcretePeripheral: 0x1dd644d0 UUID = (null), Name = "iPhone 5 #003014", IsConnected = NO>
2013-03-22 14:49:45.035 Buggy[985:110b] CoreBluetooth[ERROR] XPC connection interrupted, resetting
2013-03-22 14:49:45.050 Buggy[985:907] Central manager updated state to: 1
2013-03-22 14:49:45.116 Buggy[985:907] Central manager updated state to: 4
2013-03-22 14:49:47.271 Buggy[985:907] Central manager updated state to: 5
後這點事情又開始工作,至少要等到錯誤311環再次來襲幾分鐘後。
下面是這一直是可靠的,我一個解決辦法:
// In centralManager:didFailToConnectPeripheral:error:, ARC enabled
if (error.code == 0) {
self.centralManager.delegate = nil;
self.centralManager = nil;
// Remove all references to any peripherals you've been interacting with
[self.peripherals removeAllObjects];
/* Some delay (more than the next iteration of the runloop, less than 2 seconds) is required in order to:
* • Allow ARC to drain the autorelease pool, ensuring destruction of the centralManager
* • Allow Core Bluetooth to turn off the radio.
*
* This means that this workaround might not work if:
* • Your code has another active central manager somewhere
* • Another app is using BLE (in theory; I haven't tested this)
*/
double delayInSeconds = 2.0;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
self.centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:dispatch_get_main_queue()];
[self startScanning];
});
}
-1
如果連接了一段時間後得到的錯誤似乎很有可能在分析和解決方案將幫助:
http://lists.apple.com/archives/bluetooth-dev/2013/Jan/msg00069.html
相關問題
- 1. CoreBluetooth [錯誤] XPC連接中斷,重置
- 2. CoreBluetooth [警告]未知錯誤:2
- 3. CoreBluetooth反覆斷開
- 4. CoreBluetooth [警告]未知錯誤:241
- 5. 與非iOS設備的CoreBluetooth連接
- 6. ios- cbcentralManager狀態未知和CoreBluetooth [警告] <CBConcreteCentralManager>未通電
- 7. iOS CoreBluetooth與UUID重新連接設備
- 8. 警告:遠程連接斷開連接,連接到169.254.169.254超時
- 9. 如何使用corebluetooth連接兩個iPhone?
- 10. Corebluetooth連接如何在連接時節省電池電量
- 11. 避免在CoreBluetooth重新連接時發現服務和特徵
- 12. CoreBluetooth APIMISUSE(發送命令 - 周邊未連接)
- 13. 啓動CoreBluetooth從外設重新連接
- 14. CoreBluetooth能否與Android BLE設備連接?
- 15. 設置iOS-Corebluetooth框架中的連接參數
- 16. 如何在iOS連接或斷開連接時獲得通知?
- 17. iOS CoreBluetooth在後臺重新連接應用程序
- 18. 的iOS:在Corebluetooth
- 19. iOS - 當藍牙設備斷開連接時收到通知
- 20. 在android上使用HTTPS連接發生未知協議錯誤
- 21. CoreBluetooth在CBPeripheralManager中接收通知
- 22. CoreBluetooth廣告檢測時間
- 23. CoreBluetooth知道廣告何時停止
- 24. iOS通知連接狀態更改斷開連接並返回
- 25. 可以使用CoreBluetooth框架連接到非Apple設備嗎?
- 26. iOS背景下的CoreBluetooth廣告10
- 27. CoreBluetooth - 在backgrund模式下的iPhone廣告
- 28. iOS 7 CoreBluetooth retrievePeripheralsWithIdentifiers not retrieve
- 29. 顯示器連接或斷開連接時的通知
- 30. CoreBluetooth XPC連接在關閉視圖控制器時無效
成功連接到外圍設備「CoreBluetooth [WARNING] Unknown error:14」導致它斷開連接後出現此錯誤。有任何想法嗎? – mikemeli 2013-03-22 23:42:44
看起來像你已經發布了[這個問題](堆棧溢出)(http://stackoverflow.com/questions/15581684/corebluetoothwarning-unknown-error-14-on-iphone-5)。我不知道手,但[你並不孤單](http://e2e.ti.com/support/low_power_rf/f/538/p/220588/777454.aspx)。 – numist 2013-03-23 01:34:47