Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/110.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
iOS直接扫描服务id为的CBUUID无效_Ios_Bluetooth Lowenergy - Fatal编程技术网

iOS直接扫描服务id为的CBUUID无效

iOS直接扫描服务id为的CBUUID无效,ios,bluetooth-lowenergy,Ios,Bluetooth Lowenergy,我尝试连接我的BLE设备 但是当我引导BLE设备CBUUID时,它是无法发现的 当我设置scanForPeripheralsWithServices:nil时,它可以发现所有外围设备和connectPeripheral成功 为什么我直接扫描外设:uuidArray,它总是不进入下面的方法 - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral adve

我尝试连接我的BLE设备

但是当我引导BLE设备CBUUID时,它是无法发现的

当我设置scanForPeripheralsWithServices:nil时,它可以发现所有外围设备和connectPeripheral成功

为什么我直接扫描外设:uuidArray,它总是不进入下面的方法

 - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
我指示CBUUID如下所示:

 - (void) centralManagerDidUpdateState:(CBCentralManager *)central{

if( central.state != CBCentralManagerStatePoweredOn){
    NSLog(@"ble not turn on ");
    return;
}

   NSArray *uuidArray= [NSArray arrayWithObjects:[CBUUID UUIDWithString:@"ABC0"],[CBUUID UUIDWithString:@"27240EA9-D950-4356-A347-DEAAAB8217F6"],nil];

  [self.centralManager scanForPeripheralsWithServices:uuidArray options:@{ CBCentralManagerScanOptionAllowDuplicatesKey : @YES }];

 }

 - (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI {

   NSLog(@"Discovered %@ at %@ of identifier %@", peripheral.name, RSSI,peripheral.identifier);


if (self.connectPeripheral != peripheral) {

    self.connectPeripheral = peripheral;
    [self.centralManager connectPeripheral:peripheral options:nil];
}

 }

 ...
我正在使用“浅蓝色”应用程序跟踪下面的外围设备信息,有人能告诉我有什么问题吗?多谢各位


在浅蓝色中显示有关“广告数据”的更多信息。在那个里你们可以看到在广告包中广告的服务uuid。您必须扫描此uuid。您无法扫描其他服务,因为在连接到外围设备之前它们是未知的。

您无法扫描设备ID(即
27240EA9-D950-4356-A347-deaab8217f6
)-您只能扫描广告服务;根据LightBlue显示的屏幕截图,应该可以扫描
abc0
。尝试使用
nil
扫描服务列表。我尝试扫描abc0,但它不起作用。如果我将设备设置为默认服务UUID FFE0和特征FFE1,它可以扫描。为什么?4位UUID是“已知”UUID,但我不相信abc0是定义的“已知”UUID-