Multiple CBCentralManager instances?

不打扰是莪最后的温柔 提交于 2019-12-11 13:11:40

问题


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

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>.
 *
 */

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).


回答1:


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.



来源:https://stackoverflow.com/questions/30309401/multiple-cbcentralmanager-instances

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!