2014-09-20 73 views
0

我有一个iOS应用程序正在连接到使用ble的设备。 iOS 7正在工作。升级到iOS 8后,CBCentralManager未找到任何外围设备。iOS 8和ble CBCentralManager不工作

case CBCentralManagerStatePoweredOn: 
    { 

     NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], CBCentralManagerScanOptionAllowDuplicatesKey, nil]; 
     //NSArray *services = [NSMutableArray new]; 
     NSArray *services = @[[CBUUID UUIDWithString:@"0000FBB0-494C-4F47-4943-544543480000"], [CBUUID UUIDWithString:@"180A"]]; 
     [centralManager scanForPeripheralsWithServices:services options:options]; 

     break; 
    } 

回答

0

尝试移动此代码:

NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:FALSE], CBCentralManagerScanOptionAllowDuplicatesKey, nil]; 
    //NSArray *services = [NSMutableArray new]; 
    NSArray *services = @[[CBUUID UUIDWithString:@"0000FBB0-494C-4F47-4943-544543480000"], [CBUUID UUIDWithString:@"180A"]]; 
    [centralManager scanForPeripheralsWithServices:services options:options]; 

到伊巴动作,然后呼吁CBCentralManagerStatePoweredOn

行动