It feels like I'm missing something here, but how can I get feedback on whether pairing a passcode protected peripheral failed or succeeded?
When I to connect a peripheral which is password protected the password UIAlertView pops up and the peripheral connects (didConnectPeripheral is called) and disconnects (didDisconnectPeripheral) immediately.
[bluetoothManager connectPeripheral:peripheral options:nil];
Now whether I enter the correct passcode, the wrong passcode or simply press cancel: on all occasions I don't receive any feedback from the CoreBluetooth delegate methods.
The question is how can I get feedback on this process?
Faced the same issue after years of the question being posted here. Surprisingly Apple does not provide any callbacks on whether the pairing was successful. However the following steps can be used to conclude the same:
CBCentralManager
is in.poweredOn
state:.notify
property, write some data with write type as.withResponse
If the pairing was not successful because of invalid passcode entry or cancellation by the user, you will get an error saying “Authentication is insufficient”
Else the write to the characteristic will be successful and error object will be nil.