本文介绍了多CBCentralManager实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否支持多个 CBCentralManager 实例?如果是这样,其中的iOS版本,他们才开始得到支持?

Are multiple CBCentralManager instances supported? If so, in which version of iOS did they begin to be supported?

我发现的的。然而,这不是异常或有一个理论 + sharedCentralManager 执行。其中指出,文件说,他们不支持。但是,这已不再<一提到href=\"https://developer.apple.com/library/$p$prelease/ios/documentation/CoreBluetooth/Reference/CBCentralManager_Class/index.html\"相对=nofollow>文档,而目前的头文件注释(iOS版SDK 8.3)是:

I've found multiple emails on the Apple mailing lists stating that they are not. However, this is not enforced with exceptions or by having a theoretical +sharedCentralManager. One states that the documentation says that they are not supported. However, that is no longer mentioned in the documentation, and the current header file comment (iOS 8.3 SDK) is:

/*!
 *  @class CBCentralManager
 *
 *  @discussion Entry point to the central role. Commands should only be issued when its state is <code>CBCentralManagerStatePoweredOn</code>.
 *
 */

我不希望 CBPeripheral 实例为 CBCentralManager之间移植实例(这不是这个问题是关于什么的),我只是期望有多个窗口变成了蓝牙堆栈(没有任何不规则的行为)。

I don't expect CBPeripheral instances to be portable between CBCentralManager instances (that's not what this question is about), I'd just expect to have multiple "windows" into the Bluetooth stack (without any irregular behavior).

推荐答案

随着iOS 8.3版本中,似乎创造了第二个 CBCentralManager 实例将导致二审报告其状态 CBCentralManagerStateUnsupported 2 )。因此, CBCentralManager 不支持多个实例。

As of iOS 8.3, it appears that creating a second CBCentralManager instance will cause the second instance to report its state as CBCentralManagerStateUnsupported (2). Therefore, multiple instances of CBCentralManager are not supported.

这篇关于多CBCentralManager实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 14:49