BLE send passkey programmatically [closed]

2019-06-14 18:00发布

问题:

When i connect my device to my peripheral, he asks me a passkey (a pop-up is shown on the device). I want to send this passkey programmatically during the connection.

I'm using CBCentralManager but I can't find a way to send it.

Any suggestions?

回答1:

You can't do this. This is part of the security model. If your BLE peripheral specifies that encryption is required to access one of its characteristics then pairing is required. The passkey is collected by iOS, not your application, and your application does not have any access to the passkey or the pairing/bonding process