bluetooth-le
bluetooth-le copied to clipboard
iOS 16.4.1 - scan not returning a local name
After updating an iPhone to 16.4.1, which was released a couple of weeks ago, I noticed that after performing a scan that the scan is not returning a local name.
Is anyone else seeing this issue?
Here is some additional information. We have a default device name - 'Hickory'. This is currently what is appearing after a scan with the plugin in our app with iOS 16.4.1. We set the local name to the serial number of the device. This serial number is what has been displayed after a scan with the plugin in prior iOS versions.
When I use a "generic" Bluetooth app (Light Blue) on an Apple device I get the following:
As you can see it has a serial number in the local name. This is the expected behavior.
If I set a breakpoint in Xcode within the plugin's getScanResult() function I get "nil" as the result of the local name, not the serial number - 2619W0589 I get with the generic Bluetooth app.
If I use an Apple device with an older version of iOS I get the correct local name 2619W0589:
Any insight as to what can be done to get this functionality working as before?
Thanks,
Brent
On my side, the local name is present, but after the update to iOS 16.4.1, the manufacturer data is missing. Tested on another phone with iOS 13.x and there it worked. After the update to iOS 16.4.1 the already mentioned issue appeared as well on the other device.

I had posted to several forums. about this. One suggestion was to add scan option - allowDuplicates.
Normally scans will discard the second and subsequent advertisements from a single device. If you need to receive them, set allowDuplicates to true (only applicable in requestLEScan). (default: false)
It works, though you get duplicates as per the flag.
Not sure why this would work?
I can confirm that I see this issue on some devices, but not others. I think it might be related to how iOS caches BLE Devices. On iPhones that had scanned the BLE device before I do not have this issue (and #528). The issue only occurred on devices that did scan the device for the first time.
Its been a while and a release (3.1.1) any update on this?
I can confirm that I see this issue on some devices, but not others. I think it might be related to how iOS caches BLE Devices. On iPhones that had scanned the BLE device before I do not have this issue (and #528). The issue only occurred on devices that did scan the device for the first time.
We had a similar issue pop up where a renamed device wouldn't appear in a name-filtered scan. We were able to reproduce it by connecting to a device for the first time, renaming the device, and then attempt to connect to it again. Seemed linked to the cache, like you suggested. Clearing it fixed the issue. We did it via some other app that inadvertently cleared it when scanning for devices.
Edit: Followed a few thread chains, and stumbled across this apple dev forum post with a response here that explains it a little better. TL;DR is there's 2 places the localname can be - advertisement and in the device's GAP. It isn't guaranteed to be in the advertisement, so kCBAdvDataLocalName
won't exist in the scan response, explaining why it shows up as nil
in the response. As to why it doesn't happen on older versions of iOS, I'm not sure yet
I've found this issue too and I fixed it. On iOS 16.4.1+ you should check for result.device.name
.
So, in your code (let's say you are doing a condition based on the name), you should write this:
if (result?.localName === 'your-service-name' || result?.device?.name === 'your-service-name') {
}