2013-10-01 36 views

回答

3

通常,CoreBluetooth使用Bluetooth Core Spec V4.0 Vol 3 Part F Sec 3.4.1.1 Table 3.3 Error Codes中定義的標準錯誤代碼。

       Error 
Name       Code Description 
============================================================================== 
Invalid Handle    0x01 The attribute handle given was not valid on 
            this server. 
Read Not Permitted   0x02 The attribute cannot be read. 
Write Not Permitted   0x03 The attribute cannot be written. 
Invalid PDU     0x04 The attribute PDU was invalid. 
Insufficient Authentication 0x05 The attribute requires authentication 
            before it can be read or written. 
Request Not Supported  0x06 Attribute server does not support the 
            request received from the client. 
Invalid Offset    0x07 Offset specified was past the end of the 
            attribute. 
Insufficient Authorization 0x08 The attribute requires authorization before 
            it can be read or written. 
Prepare Queue Full   0x09 Too many prepare writes have been queued. 
Attribute Not Found   0x0A No attribute found within the given 
            attribute handle range. 
Attribute Not Long   0x0B The attribute cannot be read or written 
            using the Read Blob Request 
Insufficient Encryption Key 0x0C The Encryption Key Size used for encrypting 
Size        this link is insufficient. 
Invalid Attribute Value  0x0D The attribute value length is invalid for 
Length        the operation. 
Unlikely Error    0x0E The attribute request that was requested 
            has encountered an error that was unlikely, 
            and therefore could not be completed as 
            requested. 
Insufficient Encryption  0x0F The attribute requires encryption before it 
            can be read or written. 
Unsupported Group Type  0x10 The attribute type is not a supported 
            grouping attribute as defined by a higher 
            layer specification. 
Insufficient Resources  0x11 Insufficient Resources to complete the 
            request 
Reserved    0x012 – 0x7F Reserved for future use. 
Application Error  0x80 – 0xFF Application error code defined by a higher 
            layer specification. 

請注意,iOS有一些問題,出現任意的錯誤代碼。例如,如果您在特定時間內未能作爲外設應用程序回覆請求,則返回的錯誤代碼沒有任何意義。

真正的錯誤代碼始終僅在打印到控制檯的警告中可見。在任何情況下,NSError都沒有提供我迄今爲止遇到的CoreBluetooth的詳細信息。

+0

這是很棒的信息!我不知道藍牙規範中有一個預定義的錯誤列表,但是有一個是有道理的,而CB將主要使用它們。 – cbowns

2

Apple的文檔包含一個列表CoreBluetooth Constants,其中包含您將從框架收到的大多數錯誤代碼。

我也開始Wikia site for CoreBluetooth收集有關人們遇到特定errors的情況下的其他信息。

+1

大家好,謝謝你的支持。當你告訴我*爲什麼*你低估了這一點時,堆棧溢出會變得更好。 – cbowns

+0

我可以想象downvotes來了,因爲鏈接的頁面不包含任何關於問題的信息(現在它是一個建築網站 - 也許應該包括我在那裏發佈的表格)。 http://stackoverflow.com/help/how-to-answer 「總是引用重要鏈接中最相關的部分,以防目標站點無法訪問或永久脫機。」 – Etan

+0

我想這是有道理的?我主要是爲了解決長期的問題,「這個信息有沒有地方?」我將添加您在我的開發人員論壇和其他地方找到的條目和其他一些條目。 – cbowns

相關問題