1 Reply Latest reply on Nov 7, 2019 2:46 PM by DeCo_1926091

    How to remove a device from iPadOS BLE cash


      I'm creating an app to control a BLE device which I designed using the PSoC 4 BLE module. During development it is necessary to change the device's name from time to time. The problem is that after I've once paired/bonded with the device it appears that iOS saves the name based on the device's address (or something else that I have no control over). Then, after I've changed the device's name in its firmware and attempt to reconnect with it, iPadOS sees the device's address and uses the name originally associated with the device. I've tried "forgetting the device", turning Bluetooth on and off, rebooting the iPad, and restarting the app. Nothing seems to cause the OS to return the new name. BTW, I have confirmed that the device is sending the new name by using a CySmart dongle and software. I'm using an iPad Air 2 running iPadOS 13.2.

        • 1. Re: How to remove a device from iPadOS BLE cash

          Here is the answer I received from Apple Dev.:



          Unfortunately there is no way to clear the cache outside of resetting the iOS device (actually the old devices will roll out of the cache if a whole bunch of devices get cached, but that’s not a trivial solution).


          Let me explain what’s going on though:

          A BLE device has two locations where a name can be designated. One is the advertisement, and that’s the advertised name. The other one is in the GATT table, and that is the GATT Name.


          A second level of complication is how iOS listends to advertisements, and how it tries to save power. A BLE advertisement is actually 2 packets (in this context).

          One is the main ADV_IND packet, which causes central to discover the peripheral. Then, the central will send SCAN_REQ and ask for the SCAN_RSP, which will have any extra information about the peripheral that does not fit the original advertising packet. The name usually gies there, because the scannable services have to be in the first packet in order for the peripheral to be discoverable by the central.


          Trying to save power, iOS will sometimes go into a passive scan mode and will not ask for the second packet, as the data there are not supposed to change frequently. Once in this mode, it will use any cached information it has for this peripheral (based on the address).


          For the name field, if this device has been connected to before, it will always use the GATT name field (if available), and after that, it will always report the GATT name in didDiscoverPeripheral() rather than the advertised name.


          The other side effect of this caching is, even after you connected to this peripheral again, it may (and probably will) ignore the service and characteristic discovery commands, and will return whatever it has in its cache - saving radio time and power. At this stage though, there is a solution to force read the GATT services and characteristics. If the peripheral has implemented the “Service changed characteristic” and sets it to indicate that the GATT table has changed, then iOS will actually request and read the services and characteristics. After this happens, it will start reporting the new GATT Name (if it has changed) when the device is discovered.

          So, other than resetting the iOS device, after you changed the name (make sure you change it in both places), if you connect to the peripheral once (despite having the wrong name), and you set the Service Changed Characteristic, that will update the cache, and iOS will know the peripheral with this new name now, until it needs to change again.


          Argun Tekant
           Developer Technical Support


          So unless someone has figured out something that Apple either doesn't know or approve of I guess this can't be done.