CoreBluetooth Bluetooth4.0 and Bluetooth4.1 not found
Test Devices :
-(void)viewDidLoad{
manager = [[CBCentralManager alloc] initWithDelegate:self queue:dispatch_get_main_queue()];
}
-(void)centralManagerDidUpdateState:(CBCentralManager *)central{
switch (central.state) {
case CBManagerStatePoweredOff:
break;
case CBManagerStatePoweredOn:
NSLog(@"CBManagerStatePoweredOn");
[self startScanPeripheral];
break;
case CBManagerStateResetting:
break;
case CBManagerStateUnsupported:
break;
case CBManagerStateUnknown:
break;
case CBManagerStateUnauthorized:
break;
}
}
-(void)startScanPeripheral{
NSLog(@"startScanPeripheral");
[manager scanForPeripheralsWithServices:nil options:nil];
}
-(void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI{
NSLog(@"didDiscoverPeripheral : peripheral %@ %@",peripheral,[advertisementData valueForKey:CBAdvertisementDataSolicitedServiceUUIDsKey] );
}
2018-12-28 09:37:54.478389+0900 BluetoothTest[5648:2301000] didDiscoverPeripheral : peripheral (null)
Comments
Post a Comment