- (void)viewDidLoad
{
[super viewDidLoad];
dispatch_queue_t queue = dispatch_queue_create("112233", 0);
_centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:queue options:nil];
}
- (void)centralManagerDidUpdateState:(CBCentralManager *)central
{
switch (central.state)
{
case CBCentralManagerStatePoweredOn:
{
[_centralManager scanForPeripheralsWithServices:nil options:nil];
}
break;
default:
break;
}
}
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
NSLog(@"%@",RSSI);
}
这是我的代码。 我尝试了很多次,但它无法发现任何蓝牙设备。
希望有些人可以帮助我。