You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I listen for an event and when that even triggers I unsubscribe from the channel. This has about an 80% chance to produce NSGenericException*** Collection <__NSArrayM: 0x1523c7340> was mutated while being enumerated.
Thanks for the report. I can see why unsubscribing in an event handler causes this - unsubscribing from a channel removes all bindings from the channel however the event dispatcher iterates through its bindings when it receives a matching event - when the event handler is called it will be mid-way through enumerating the bindings.
A simple solution would be to copy the bindings and enumerating over the copy, but I'll have a think about whether there is a better solution.
I listen for an event and when that even triggers I unsubscribe from the channel. This has about an 80% chance to produce NSGenericException*** Collection <__NSArrayM: 0x1523c7340> was mutated while being enumerated.
This is the stacktrace that bugsnag produces
Pods/libPusher/Library/PTPusherEventDispatcher.m:68:3-[PTPusherEventDispatcher dispatchEvent:]
Pods/libPusher/Library/PTPusherChannel.m:167:3-[PTPusherChannel dispatchEvent:]
Pods/libPusher/Library/PTPusher.m:381:5-[PTPusher pusherConnection:didReceiveEvent:]
Pods/libPusher/Library/PTPusherConnection.m:158:3-[PTPusherConnection webSocket:didReceiveMessage:]
Pods/SocketRocket/SocketRocket/SRWebSocket.m:753:9_30-[SRWebSocket _handleMessage:]_block_invoke
The workaround I have in order for it not to crash is to add a delay to the unsubscribing of about 1s.
The text was updated successfully, but these errors were encountered: