Description
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.