在iPhone周围找到蓝牙设备?

时间:2014-10-14 13:38:34

标签: ios objective-c bluetooth

我正在尝试使用iPhone打开蓝牙设备。

我应该寻找哪种蓝牙服务UUID?

这是我尝试使用模拟器的代码我找不到任何设备:

centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil];

[centralManager scanForPeripheralsWithServices:
        @[[CBUUID UUIDWithString:@"1101"],
          [CBUUID UUIDWithString:@"1102"],
          [CBUUID UUIDWithString:@"1105"],
          [CBUUID UUIDWithString:@"1106"],
          [CBUUID UUIDWithString:@"1115"],
          [CBUUID UUIDWithString:@"1116"],
          [CBUUID UUIDWithString:@"1117"],
          [CBUUID UUIDWithString:@"0001"],
          [CBUUID UUIDWithString:@"0003"],
          [CBUUID UUIDWithString:@"0008"],
          [CBUUID UUIDWithString:@"0100"],
          [CBUUID UUIDWithString:@"000F"],
          [CBUUID UUIDWithString:@"1101"],
          [CBUUID UUIDWithString:@"1116"],
          [CBUUID UUIDWithString:@"1000"],
          [CBUUID UUIDWithString:@"1001"],
          [CBUUID UUIDWithString:@"1002"],
          [CBUUID UUIDWithString:@"0010"],
          [CBUUID UUIDWithString:@"0011"],
          [CBUUID UUIDWithString:@"0012"],
          [CBUUID UUIDWithString:@"0013"],
          [CBUUID UUIDWithString:@"0014"],
          [CBUUID UUIDWithString:@"0015"],
          [CBUUID UUIDWithString:@"0016"],
          [CBUUID UUIDWithString:@"0017"],
          [CBUUID UUIDWithString:@"0018"],
          [CBUUID UUIDWithString:@"0019"],
          [CBUUID UUIDWithString:@"001B"],
          [CBUUID UUIDWithString:@"001E"],
          [CBUUID UUIDWithString:@"001F"],

          ]
                                       options:nil];

1 个答案:

答案 0 :(得分:0)

ExternalAccessory框架为您提供了一种使用EAAccessoryManager列出可用设备的简便方法。

NSArray *accessories = [[EAAccessoryManager sharedAccessoryManager] connectedAccessories];

您无法在模拟器中执行此操作。