chinloyal / pusher_client

A Pusher Channels Client for Fluttter (Fully supports Android and iOS)
https://pusher.com/channels
MIT License
42 stars 175 forks source link

When disconnecting the pusher got error #38

Closed yenyichau closed 2 years ago

yenyichau commented 2 years ago

Hi, I'm using iPhone 12 Pro max (iOS 14.5) simulator to do testing. My simulator exit the app when i dismiss the page. My dispose included these 2 function pusher disconnect & Channel unbind. Here is the error message that debug console return to me. I've no idea what is the problem.

pusher_client/PusherService.swift:179: Fatal error: Unexpectedly found nil while unwrapping an Optional value
Lost connection to device.
yenyichau commented 2 years ago

I think it is my dispose function sequence is wrong. Should do like this.

channel.unbind("event name");
pusher.unsubscribe('private-message-channel');
pusher.disconnect();