react-native-ble-plx icon indicating copy to clipboard operation
react-native-ble-plx copied to clipboard

🐛 iOS scan result missing localName despite correct advertisement

Open VeyDlin opened this issue 7 months ago • 2 comments

Prerequisites

  • [x] I checked the documentation and FAQ without finding a solution
  • [x] I checked to make sure that this issue has not already been filed

Expected Behavior

The localName field in the scan result should contain the advertised name as configured on the BLE peripheral.

Current Behavior

On iPhone 12 Pro (iOS 17.4), the localName field is always null (for my device), even though:

  • The same BLE peripheral advertises the name correctly (Complete Local Name is set in FW).
  • The correct name is shown in nRF Connect on the same iPhone.
  • The correct name is also displayed in another Flutter-based app on the same iPhone.
  • The correct localName is shown in Android apps using the same BLE peripheral and this library

So the device is definitely advertising the correct name. The issue only appears when scanning using this library on iOS.

Library version

3.5.0

Device

iPhone 12 Pro

Environment info

System:
  OS: Windows 11 10.0.27842
  CPU: (16) x64 12th Gen Intel(R) Core(TM) i5-12600K
  Memory: 37.10 GB / 63.77 GB
Binaries:
  Node:
    version: 22.14.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: ~\AppData\Roaming\npm\yarn.CMD
  npm:
    version: 10.9.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK:
    API Levels:
      - "35"
    Build Tools:
      - 26.0.1
      - 26.0.2
      - 26.0.3
      - 34.0.0
      - 35.0.0
      - 35.0.1
      - 36.0.0
    System Images:
      - android-36 | Google Play Intel x86_64 Atom
    Android NDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-243.25659.59.2432.13423653
  Visual Studio:
    - 17.13.35919.96 (Visual Studio Community 2022)
Languages:
  Java: 17.0.12
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli":
    installed: 17.0.0
    wanted: ^17.0.0
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.7
    wanted: 0.76.7
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

info React Native v0.79.2 is now available (your project is running on v0.76.7).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.79.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.76.7&to=0.79.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=windows".

Steps to reproduce

...

Formatted code sample or link to a repository

BleManager.startDeviceScan(null, null, (error, device) => {
  if (error) {
    console.warn(error);
    return;
  }

  console.log(JSON.stringify(device, null, 2));
});

Relevant log output

[
  {
    "id": "778F707E-A2F9-1661-F38D-75A6A13CFCB5",
    "isConnectable": true,
    "localName": null,
    "manufacturerData": null,
    "mtu": 23,
    "name": "NRF8001",
    "overflowServiceUUIDs": null,
    "rawScanRecord": "eyJzb2xpY2l0ZWRTZXJ2aWNlVVVJRHMiOm51bGwsIm92ZXJmbG93U2VydmljZVVVSURzIjpudWxsLCJyc3NpIjotNDUsIm5hbWUiOiJOUkY4MDAxIiwibWFudWZhY3R1cmVyRGF0YSI6bnVsbCwic2VydmljZVVVSURzIjpbIjZlNDAwMDAxLWI1YTMtZjM5My1lMGE5LWViMGUyNGRjY2E5ZSJdLCJtdHUiOjIzLCJpc0Nvbm5lY3RhYmxlIjp0cnVlLCJsb2NhbE5hbWUiOm51bGwsImlkIjoiNzc4RjcwN0UtQTJGOS0xNjYxLUYzOEQtNzVBNkExM0NGQ0I1Iiwic2VydmljZURhdGEiOm51bGwsInR4UG93ZXJMZXZlbCI6bnVsbH0=",
    "rssi": -45,
    "serviceData": null,
    "serviceUUIDs": [
      "6e400001-b5a3-f393-e0a9-eb0e24dcca9e"
    ],
    "solicitedServiceUUIDs": null,
    "txPowerLevel": null
  }
]

Additional information

  • This exact BLE peripheral shows the correct name in nRF Connect and another Flutter-based BLE app on the same iPhone.
  • It works perfectly on Android as well.

This seems to be a problem with how react-native-ble-plx processes or exposes the scan result on iOS.

VeyDlin avatar May 27 '25 16:05 VeyDlin

I have seen something similar, only on iOS. I was able to force a temporary localName resolution by using another app - Bluetooth Scanner (I assume nRF Connect would do that same thing) and connecting to the device. That seems to reset an underlying OS cache and re-read the localName. After that, was able to resolve my localName with no change to the device.

sugarlata-zetifi avatar Jul 08 '25 01:07 sugarlata-zetifi

I'm seeing the same issue for an Expo app on an iPad 10 device. Is there are fix or workaround for this?

jkuhs avatar Oct 09 '25 17:10 jkuhs