适用于iOS 7的核心蓝牙弃用 [英] Core Bluetooth deprecations for iOS 7

查看:184
本文介绍了适用于iOS 7的核心蓝牙弃用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在iOS 7中,一些核心蓝牙产品现已被弃用,如CBUUIDGenericAccessProfileString和CBUUIDDeviceNameString。 apple docs 状态

In iOS 7, some Core Bluetooth things are now deprecated like CBUUIDGenericAccessProfileString and CBUUIDDeviceNameString. The apple docs state

"(Deprecated. There are no replacements for these constants.)"

我想知道我们应该做些什么来取代这些GAP的东西,因为苹果文档和示例没有任何帮助。整个互联网似乎也对此保持沉默。我的代码就像心率监测示例仍有不推荐的代码

I am wondering what we are supposed to do to replace these GAP things, as the apple docs and examples are of no help. The entire internet also seems to be silent about this. My code is pretty much just like the Heart Rate Monitor example which still has the deprecated code

/* GAP (Generic Access Profile) for Device Name */
if ( [aService.UUID isEqual:[CBUUID UUIDWithString:CBUUIDGenericAccessProfileString]] )
{
    [aPeripheral discoverCharacteristics:nil forService:aService];
}


推荐答案

你怎么用才通用访问服务UUID直接?

How about you just use the Generic Access service UUID directly?

if ( [aService.UUID isEqual:[CBUUID UUIDWithString:@"1800"]] )//0x1800 is the Generic Access Service Identifier
{
    [aPeripheral discoverCharacteristics:nil forService:aService];
}

点击此处查看通用访问服务

这篇关于适用于iOS 7的核心蓝牙弃用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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