ios7 - iOS 7 的核心蓝牙弃用

标签 ios7 core-bluetooth

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

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

我想知道我们应该做些什么来替换这些 GAP 东西,因为苹果文档和示例没有帮助。整个互联网似乎也对此保持沉默。我的代码很像 Heart Rate Monitor example仍然有弃用的代码

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

最佳答案

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

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

查看此处了解 Generic Access Service 的详细信息.

关于ios7 - iOS 7 的核心蓝牙弃用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19984314/

相关文章:

ios - 给定分发包ID,可以在iOS 7上获取identifierForVendor(IDFV)吗?

ios - AVPlayer 在 iOS7 中不显示视频,在 iOS8 和 iOS9 上工作正常

ios - UINavigationBar下的自定义UISearchBar错误的色调

ios - 阻止其他应用程序从我的应用程序与之通信的附件接收数据

iOS 7 Popover Controller 在 xcode 6 下崩溃

xcode - 'isConnected' 在 iOS 7 中被弃用

java - iOS 应用程序可以通过蓝牙与 Mac 上的 Java 应用程序通信,而无需创建 OS X 应用程序吗?

iOS 在什么条件下 Core Bluetooth 恢复有效?

android - 有没有人将 Android 作为 Central 连接到 iOS 作为 Peripheral?

ios - ESTBeaconConnection 使 Estimote 信标无法被发现