ios - corebluetooth Reading RSSI error:The operation was cancelled -


i'm developing app using corebluetooth framework,

and connect ble device rssi value.

i set function read rssi periodly, timer code below

nstimer *timer; timer = [nstimer scheduledtimerwithtimeinterval:1.2f target:self selector:@selector(detectrssi) userinfo:nil repeats:yes]; 

and detectrssi code below

- (void)detectrssi {     [self.peripheral readrssi]; } 

so question is,

the function works fine , when set time interval less 1.2 sec,

the peripheraldidupdaterssi randomly report error message this:

the operation cancelled. 

and wouldn't happened if rate more 1.2sec.

does have idea read rssi value more (0.5 sec or less)?

i encounter same problem well. me, works when add sleep(2) inside peripheraldidupdaterssi. don't forget use background queue when initialising cbcentralmanager.

- (void)peripheraldidupdaterssi:(cbperipheral *)peripheral error:(nserror *)error {     nslog(@"rssi = %@", peripheral.rssi);     sleep(2);     [self.connectedperipheral readrssi]; } 

Comments