I'm currently building a CoreBluetooth application that I want to scan for available devices, the problem is that the AdvertismentData dictionary in "didDiscoverPeripheral" does not contain CBAdvertisementDataLocalNameKey - it only contains CBAdvDataChannel and CBAdvDataIsConnectable. This means that I am unable to identify my BLE device.
The interesting thing is that the Lightblue app (an iOS BLE scanner) is able to show the name and is thus presumably able to access "CBAdvertisementDataLocalNameKey".
Does anyone know what I'm doing wrong? I'm really tearing my hair out over this!
Here's a basic sample of my code:
-(void)scan
{
NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
[mCentralManager scanForPeripheralsWithServices:nil options:options];
}
- (void)centralManager:(CBCentralManager *)central didConnectPeripheral:(CBPeripheral *)peripheral
{
}
- (void)centralManager:(CBCentralManager *)central didDiscoverPeripheral:(CBPeripheral *)peripheral advertisementData:(NSDictionary *)advertisementData RSSI:(NSNumber *)RSSI
{
for(id key in advertisementData)
NSLog(@"key=%@ value=%@", key, [advertisementData objectForKey:key]);
}