0

BLE を使用してデバイスに接続している iOS アプリがあります。iOS7は動いています。iOS 8 にアップグレードした後、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;
    }
4

1 に答える 1

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];

Iba アクションに変換し、CBCentralManagerStatePoweredOn でアクションを呼び出します。

于 2014-09-23T01:20:51.743 に答える