Search code examples
iosiphoneswiftbluetoothcore-bluetooth

iOS bluetooth device can't unpair or forget after wrong password


I'm developing an app that has to be paired with a Bluetooth device.

Due to a mistake in the docs I tried to pair the device using a wrong passcode and now this device will appear in a "weird state".

Corebluetooth will remember it and will try to connect but, as the passcode was incorrect, it won't be able to retrieve any information.

My first impulse was going to the Device Settings and try to unpair, but surprisingly the little "i" button to show the "forget device" option is not there (see screenshot).

screenshot

Things I already tried:

  • Pair with other device using correct passcode: All Good, device working and the little "i" is presented as usual and it is possible to "Forget this device".
  • "forget network settings": no effect over Bluetooth, all devices remain the same.
  • Restore device: works but only if I don't connect to iCloud. After iCloud connection all my previously stored Bluetooth devices will appear and also this one with the wrong pass-code not working.

I need to provide a solution to final user not involving "hard reset and setup as new iPhone" but I'm starting to be kind of desperate with this. Any idea? Thanks!


Solution

  • In case somebody has a problem like this. This was a problem with the firmware of the Bluetooth device. It was storing incorrectly the bonding keys. The device reported that was paired with the phone but at the same time it didn't store the keys properly creating an encryption problem.