不工作调用centralManager:didDiscoverPeripheral:advertisementData:RSSI:function

时间:2014-02-17 10:35:45

标签: iphone cocoa-touch ios7 bluetooth-lowenergy core-bluetooth

应用程序打开后,按“打开设备”。

centralManagerDidUpdateState函数正在运行。

    CBUUID *uuid = [CBUUID UUIDWithString:@"8A1FEA41-3A2F-7860-568D-2325D6C31C91"];
    NSArray *services = [NSArray arrayWithObjects:uuid, nil];
    NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:CBCentralManagerScanOptionAllowDuplicatesKey];
    [central scanForPeripheralsWithServices:services options:options];

不会调用didDiscoverPeripheral:function。

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

但是如果调用nill值为scanForPeripheralsWithServices,则会调用didDiscoverPeripheral:function。

[central scanForPeripheralsWithServices:nil options:options];

什么是问题?请。

0 个答案:

没有答案