Closed ron3001 closed 5 years ago
Thanks for your report. The EXC_BAD_ACCESS was due to the delegate being invalid, setting this to weak
should fix it. To show how I would handle a forceful disconnect/reconnect, I tweaked the example.
Could you check whether this works for you?
Thanks a lot for the demo tweak and change in the library! Tested with the example and there were no crashes there. My implementation also did not crash with the latest changes, but I will need to test more. I have one question. Since the crash was on [LTBTLEWriteCharacteristicStream close]
shouldn't also the delegate there be changed to weak
?
Absolutely, thanks. Closing this now – please reopen, if necessary.
I've been using this library to establish BLE communication between iOS device and a vehicle for a while now - it helps a lot. Now I am getting a crash from the library, trying to disconnect the
LTBTLESerialTransporter object
. The crash is in:If there is established communication and the
disconnect method
is just called on theLTBTLESerialTransporter object
(which is after that set to nil) there is no issue. But if the OBD2 adapter is disconnected from the vehicle and therefore theOBD2AdapterStateGone
notification is received - on calling disconnect + setting theLTBTLESerialTransporter object
to nil or just setting it to nil - the crash happens. The error is EXC_BAD_ACCESS KERN_INVALID_ADDRESS and happens on-[LTBTLEWriteCharacteristicStream close]
. Is there more correct way to disconnect at this point - to avoid the crash and be able to reconnect after that? How is it intended to work?