Posts

Post marked as solved
2 Replies
1.7k Views
the following code retrieves my peripherals and allows connection in old verisons of IOS. Since Ios13 this method no longer works.. Specifically.NSArray* knownPeripherals = [self.centralManager retrievePeripheralsWithIdentifiers:@[uuid]];this does not find results, however under the same test scenrio it works on older devices . Below is the entire method. any ideas on why i can not get my peripheral would help. self.discoveredPeripheralMap = [NSMutableDictionary new]; self.connectingPeripherals = [NSMutableArray new]; NSDictionary* centralOptions = @{ CBCentralManagerOptionRestoreIdentifierKey: CentralManagerIdentifier }; self.centralManager = [[CBCentralManager alloc] initWithDelegate:self queue:nil options:centralOptions]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; NSString* savedDeviceId = [defaults objectForKey:SavedBluetoothDeviceIdentifierKey]; if(savedDeviceId) { NSUUID *uuid = [[NSUUID alloc] initWithUUIDString:savedDeviceId]; //NSUUID* uuid = [NSUUID UUIDWithString:savedDeviceId]; NSArray* knownPeripherals = [self.centralManager retrievePeripheralsWithIdentifiers:@[uuid]]; if(knownPeripherals && knownPeripherals.count > 0) { CBPeripheral* peripheral = knownPeripherals[0]; _defaultPeripheral = [[DVBPeripheral alloc] initWithPeripheral:peripheral]; [self.discoveredPeripheralMap setObject:self.defaultPeripheral forKey:peripheral.name]; if(self.centralManager.state == CBCentralManagerStatePoweredOn) { [self connect:self.defaultPeripheral]; } } }}
Posted
by kressler.
Last updated
.