2014-06-24 92 views
3

我真的陷入了一個問題,因此,不用說,我需要你的幫助。 我正在使用CoreBluetooth在兩個iDevices之間進行通信,它是同一個應用程序,作爲一個設備上的中央設備運行,並作爲另一個設備上的外設運行。在一些情況下,中央斷開連接到外圍,錯誤如下:CoreBluetooth和Wifi干擾

Error Domain=CBErrorDomain Code=10 "The connection has failed unexpectedly." UserInfo=0x14ee8fe0 {NSLocalizedDescription=The connection has failed unexpectedly.} 

在這個特定的情況下,外圍是一個iPad 4和中央是一個iPad迷你。 我追蹤了這個問題,結果發現,一旦我遇到這個問題,無論重新啓動應用甚至是雙方的藍牙,每次連接都會出現問題,但有趣的部分是,如果我轉過身關閉中央設備上的Wifi,連接不會超時。

您有任何建議,解決方法嗎?這兩個設備都運行iOS 7.1.1

回答

5

這是一個衆所周知的問題,它有一個solution已確認可用於Mac端。

sudo defaults write /Library/Preferences/com.apple.airport.bt.plist bluetoothCoexMgmt Hybrid 

運行此腳本後,問題將消失,BT連接將保持穩定。

這裏的解釋是:

Background: after a lot of snooping and head scratching, here's what I found: the issue here seems to be that the system isn't using the same Bluetooth/Airport coexistance mode for BLE as it uses for BT Classic. One tell tale sign: if you have any BT Classic devices connected and active, the bug won't repro (neither for the Classic device nor any connected BLE device). The moment the Classic device disconnects, the bug repros (ie all the BLE connections are also dropped).

Further, I was able to find reference in the symbol table of an airport configd agent to an override setting for the coexistance mode. If you set the mode manually as above to 'hybrid' (the same mode that is usually invoked when a classic device is connected), the bug no longer repros.

所有學分去威廉·亨德森從爆震這一招。

有些情況下,iOS設備上也會看到相同的效果。當核心藍牙連接不穩定時會發生這種情況。有時這可能導致WiFi連接無法使用。但是很難複製,至少我沒有辦法,你的問題也沒有關係。

+0

感謝您的好評!事實上,我還沒有想出如何複製這個問題,它主要發生在通過藍牙進行的大量通信之後,但它有所不同。 –

+0

在Mac上,如果您有BLE連接並且您同時開始使用WiFi,則會發生這種情況。如果沒有這個補丁,這很可能會導致立即連接中斷。只要嘗試下載一些文件,開始Skype視頻通話或任何加載WiFi連接。 (洪流是最好的測試:)) – allprog

+0

當我的電腦連接到我的電腦作爲wifi熱點時,我能夠始終如一地重現此情況。當這種情況發生時,藍牙連接將在50-60%的時間內失效。 – skladek