当我使用以下方法扫描 2 个外围设备时,每个外围设备都有一个服务和特性(同时cServiceArray
是两个服务 CBUUID 的 NSArray):
[self.centralManager scanForPeripheralsWithServices:cServiceArray options:@{CBCentralManagerScanOptionAllowDuplicatesKey : @NO }];
我收到以下控制台响应:
2013-10-18 13:58:37.069 BlueMarco[1137:60b] didDiscoverPeripheral peripheral description <CBPeripheral: 0x14e799d0 identifier = 33C98AC7-E25E-0803-82D2-326FC8C0FDB1, Name = "ICServer_2", state = disconnected>
...
2013-10-18 13:58:37.072 BlueMarco[1137:60b] didDiscoverPeripheral Connecting to peripheral ICServer_2
...
2013-10-18 13:58:37.076 BlueMarco[1137:60b] didDiscoverPeripheral peripheral description <CBPeripheral: 0x14e75b60 identifier = E634E343-0DCF-3A4F-1F88-D4C87EA731EA, Name = "ICServer_1", state = disconnected>
...
2013-10-18 13:58:37.079 BlueMarco[1137:60b] CoreBluetooth[WARNING] <CBPeripheral: 0x14e799d0 identifier = 33C98AC7-E25E-0803-82D2-326FC8C0FDB1, Name = "ICServer_2", state = connecting> is being dealloc'ed while connecting
2013-10-18 13:58:37.080 BlueMarco[1137:60b] didDiscoverPeripheral Connecting to peripheral ICServer_1
这表明当我与第二台服务器建立连接时,与一个外围设备的连接中断。这是预期的行为吗?如果是这样,为什么该方法scanForPeripheralsWithServices
允许服务 CBUUID 的 NSArray 作为参数?如果没有,谁能告诉我如何扫描和处理多项服务的接收?