CentralManager does not get the changed localNameKey at advertisement[CBAdvertisementDataLocalNameKey]

I scan my ble device with the code below.

centralManager.scanForPeripherals(withServices: [connectionServiceUUID], options: nil)

and the call back method is called when the device is scaned.

func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) { ... }

I have 2 questions with the value of advertisementData[CBAdvertisementDataLocalNameKey] from the callback method.

Suppose there is connections, and the localNameKey of the device is A. When it is scanned and connected at first, the advertisementData[CBAdvertisementDataLocalNameKey] I get is not A but something else. Here, if I do the same then I get A. Now, I change the localNameKey of the device to B. And when it is scanned, the advertisementData[CBAdvertisementDataLocalNameKey] is still A, and I do the same, now it is B. Why?

When the screen is off, advertisementData[CBAdvertisementDataLocalNameKey] never changes, why?

CentralManager does not get the changed localNameKey at advertisement[CBAdvertisementDataLocalNameKey]
 
 
Q