iOS UUID弃用了corebluetooth

时间:2014-10-09 13:30:39

标签: ios uuid core-bluetooth deprecation-warning

我正在修改一个通过蓝牙BLE发现设备的应用程序,以便将值绘制成图形。这一切都很好(感谢过去一周你们中的一个人的帮助)。该应用程序最初是由我的丈夫写的,在设备发现期间,他使用的检查代码如下:

NSLog(@" Failed to Connect to Peripheral : %@   with UUID: %@   ", peripheral, peripheral.UUID);

NSLog(@" Connected to Peripheral : %@   with UUID: %@   ", peripheral, peripheral.UUID);

在这些行(以及更多行)的前面,我收到UUID已弃用的警告消息:首先在ios 7.0中弃用 很长一段时间以来,我试图找出被替换的内容,但在Google上,看起来其他人没有同样的问题,当我转到Apple文档时:here < / p>

没有提及它被弃用。

我不明白......

有人可以帮忙吗?感谢

编辑:添加一些信息

这是我在控制台上的计算机上获得的内容

enter image description here

3 个答案:

答案 0 :(得分:15)

<强>更新

我已经仔细检查过,CBPeer上的UUID属性也已弃用。

我从Xcode的文档中找到了 -

  

弃用声明
   请改用标识符属性。

如果您使用peripheral.identifier.UUIDString,则不会收到弃用警告。

答案 1 :(得分:3)

所以,以防有人读到这个: 以下是找出使用内容而不是弃用的API调用的一般方法 1)标记弃用的呼叫
2)右键单击“跳转到定义”
3)阅读那里所说的内容。

如果在这里询问UUID,答案将是以下2行:

@property (readonly, nonatomic) NSUUID *identifier NS_AVAILABLE(NA, 7_0);

答案 2 :(得分:2)

您可以通过广告数据中的CBAdvertisementDataServiceUUIDsKey访问服务UUID

<input type="button" id="btn" class="btncss" value="filter" />
<div id="div1" runat="server"  style="height:300px;width:300px;background-color:#f3fbd6">
    <table>
        <tr>
            <td>
                <asp:TextBox ID="txt" runat="server" TextMode="MultiLine"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:DropDownList ID="ddl" runat="server"></asp:DropDownList>
            </td>
        </tr>
    </table>
    <hr />
    <table>
        <tr>
            <td>
                <asp:Button ID="btncancel" runat="server" Text="cancel" />
            </td>
            <td>
                <asp:Button ID="btnFilter" runat="server" CssClass="btncss" Text="Filter" />
            </td>
        </tr>
    </table>
</div>