简体   繁体   中英

Multiple CBCentralManager instances?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM