ios - retrievePeripherals deprecated in IOS7 how to substitude it with retrievePeripheralsWithIdentifiers -


i using "[self.manager retrieveperipherals:[nsarray arraywithobject:(id)aperipheral.uuid]];” works fine deprecated in ios7. found have use “retrieveperipheralswithidentifiers” instead. can not figure out right syntax new function. can please translate

"[self.manager retrieveperipherals:[nsarray arraywithobject:(id)aperipheral.uuid]];” 

to new function “retrieveperipheralswithidentifiers”.

// invoked when central discovers heart rate peripheral while scanning. - (void) centralmanager:(cbcentralmanager *)central   diddiscoverperipheral:(cbperipheral *)aperipheral   advertisementdata:(nsdictionary *)advertisementdata                rssi:(nsnumber *)rssi {     nsmutablearray *peripherals = [self mutablearrayvalueforkey:@"heartratemonitors"];     if(![self.heartratemonitors containsobject:aperipheral])     [peripherals addobject:aperipheral];      // retrieve known devices [self.manager retrieveperipherals:[nsarray arraywithobject:(id)aperipheral.uuid]]; 

}

finally solve it, hope helps.

// invoked when central discovers heart rate peripheral while scanning. - (void) centralmanager:(cbcentralmanager *)central   diddiscoverperipheral:(cbperipheral *)aperipheral   advertisementdata:(nsdictionary *)advertisementdata                rssi:(nsnumber *)rssi { [self.manager retrieveperipheralswithidentifiers:@[[cbuuid uuidwithstring:@"180d"]]];  nslog(@"centralmanager diddiscoverperipheral -> discovered: %@", aperipheral.name);  if (aperipheral) {     [self stopscan];     _peripheral = aperipheral;     [_manager connectperipheral:self.peripheral                         options:[nsdictionary dictionarywithobject:                                  [nsnumber numberwithbool:yes]                                                             forkey:                                  cbconnectperipheraloptionnotifyondisconnectionkey]]; }   } 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -