Post

Replies

Boosts

Views

Activity

Mocking or simulating CBPeripheral, CBCentralManager, etc in tests
I am developing an app that uses CoreBluetooth to communicate with a proprietary piece of hardware. I would like to be able to write tests for it, but there does not seem to be any way to mock or simulate the presence of, for example a CBPeripheral object. This library (https://github.com/NordicSemiconductor/IOS-CoreBluetooth-Mock) almost does what I need, but it's not quite flexible enough. I think they have the right idea, but it doesn't seem to be actively maintained anymore. This seems like a pretty big hole in the iOS SDK. Is there really not an officially supported way of testing BLE functionality?
3
0
381
Sep ’24
Handling incorrect PIN entry on BLE connection
I'm developing an app that pairs to a custom piece of hardware over BLE. Right now I'm working on a way to handle the case where the user mis-enters the PIN code. I see that didUpdateNotificationStateFor is passed an error message in this case saying "Encryption is insufficient.". But it seems like there has to be a better way to handle and react to that case. Do I really need to rely on a string-compare against error message in order to determine when to display the instructions on how to reset everything and restart the pairing workflow? Is there something I'm missing in this documentation?
1
0
362
Aug ’24