I am working on scanning BLE in the background.
The problem does not work in the background. It works very well in foreground mode.
Below are a few lines of code.
dispatch_queue_t centralQueue = dispatch_queue_create("com.XXXXX.BLEback", DISPATCH_QUEUE_SERIAL);
- (void)centralManagerDidUpdateState:(CBCentralManager *)central { if (central.state == CBCentralManagerStatePoweredOn) { [self startScan]; } if (![self supportLEHardware]) { @throw ([NSError errorWithDomain:@"Bluetooth LE not supported" code:999 userInfo:nil]); } }
- (void)startScan { NSDictionary * options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:false] forKey:CBCentralManagerScanOptionAllowDuplicatesKey]; [manager scanForPeripheralsWithServices:nil options:options]; }
here i pass zero as services.
I get the log in the Devices section in Xcode. But not in the application.
Notice>: (Error) Discovered unknown type for scan: { kCBAdvDataChannel = 37; kCBAdvDataIsConnectable = 1; kCBAdvDataManufacturerData = <00003962 6708f4c1 00000000 00d02b00 20d03300 20d03300 20>; kCBAdvDataWSaturated = 0; kCBAdvDataWlanRSSI = 0; }, -51, puck type: 57
ios iphone bluetooth-lowenergy core-bluetooth cbcentralmanager
Solid soft
source share