MQTT-Client-Framework
MQTT-Client-Framework copied to clipboard
a crash in here
Other information


Which DisptachQueue have you set for the MQTTSession? if it's global, change to something like:
DispatchQueue(label: "mqttqueue")
Are you able to reproduce this issue consistently? Could you give us more details about it?
I've also encountered similar crash in the old version. I use auth to connect the broker. When the connack is not authorized, in the delegate callback method, reconnect immediately. MQTTSession will create a new MQTTDecoder instance, and the old MQTTDecoder instance has been dealloc. at the line 131 in MQTTDecoder.m, self has been dealloc, so crash the EXC_BAD_ACCESS. NSStream.delegate is assign. In NSStreamDelegate method, MQTTDecoder retaincount is 1 (only retain by MQTTSession).
My solution: don't reconnect immediately in the same runloop cycle when connect failed
