问题
I'm working on an application that connects phones via core bluetooth (BLE). The connection and data transmission work beautifully, but there is one small imperfection. When connecting to a new device, a pin must be entered on one of the devices. The application is supposed to be very instantaneous, and the pin-input greatly interrupts this process. I'm not worried about security, and I've personally connected my phone to many bluetooth devices without entering pins, so I was just wondering how this could be done with the iOS api.
Thanks!
回答1:
If you specify any of your peripheral's characteristics with an 'encryptionRequired' property (CBCharacteristicPropertyNotifyEncryptionRequired
or CBCharacteristicPropertyIndicateEncryptionRequired
) or permissions (CBAttributePermissionsReadEncryptionRequired
or CBAttributePermissionsWriteEncryptionRequired
) then bonding is required between the devices.
If the devices aren't already bonded then this will trigger the pairing dialog and require a pin to be entered. If you don't specify any of the encryption properties or permissions on your peripheral's characteristics then you won't be prompted to pair.
来源:https://stackoverflow.com/questions/31097414/removing-pin-in-core-bluetooth-connection