I have 8.0, it works fine.
-(void) startScanForRSSI{ timerRSSI = [NSTimer scheduledTimerWithTimeInterval:10.0f target:self selector:@selector(detectRSSI) userInfo:nil repeats:YES]; } - (void)detectRSSI { if (state == ...) { peripheral.delegate = self; [peripheral readRSSI]; } else { if (timerRSSI && [timerRSSI isValid]) { [timerRSSI invalidate]; } } } - (void)peripheralDidUpdateRSSI:(CBPeripheral *)peripheral error:(NSError *)error { NSLog(@"Got RSSI update: %4.1f", [peripheral.RSSI doubleValue]); NSNumber *rssiNum = peripheral.RSSI; }
Since the above is deprecated in iOS 8, having tried another delegate, it will report.
-(void) peripheral:(CBPeripheral *)peripheral didReadRSSI:(NSNumber *)RSSI error:(NSError *)error { NSLog(@"Got RSSI update in didReadRSSI : %4.1f", [RSSI doubleValue]); }
This seems to be the OSX delegate method. Apple is likely to add something in iOS for RSSI soon.
On iOS 8.0, didReadRSSI works. In the documentation 8.0.2 it is not listed in iOS.
If I put both methods, then didReadRSSI will be called in iOS 8, and the peripheral DidUpdateRSSI will be called in iOS 7.
Therefore, do not update iOS 8.0.2 until Apple places something in the RSSI.
Has anyone tried the beta version of iOS 8.1?
It seems that when scanning devices, RSSI cannot be read. If a call to [CBCentralManager scanForPeripheralsWithServices ...] has been initiated, the ReadRSSI effect does not occur (delegates are not called). But if [CBCentralManager stopScan] is issued, ReadRSSI starts to respond.
Also note: the device must be in a connected state for issuing commands, otherwise you will receive: CoreBluetooth [API MISUSE] CBPeripheral can receive commands only in a connected state.
Gamma point
source share