iosflutterpusherpusherswift

Pusher Channels Flutter is not working on iOS devices


It's working perfectly fine on Android devices, but I'm running into issues when testing on iOS devices. Specifically, the real-time communication feature doesn't seem to be working on iOS devices.

And I already did it iOS specific installation # The Pusher Channels Flutter plugin adds the pusher-websocket-swift cocoapod to your project. You probably need to run a

$ pod install in the ios directory.

and this is my podfile.lock

  - pusher_channels_flutter (0.0.1):
    - Flutter
    - PusherSwift (~> 10.1.1)
  - PusherSwift (10.1.3):
    - NWWebSocket (~> 0.5.3)
    - TweetNacl (~> 1.0.0)

and also I opened this issue pusher-channels-flutter/issues/115

I need help to build it on iOS


Solution

  • Remove authEndpoint: url from the init function as it's only used in the web version, causing issues on iOS.

     await pusher.init(
            apiKey: 'f****************',
            cluster: 'eu',
            onConnectionStateChange: onConnectionStateChange,
            onError: onError,
            onSubscriptionSucceeded: onSubscriptionSucceeded,
            onEvent: onEvent,
            onSubscriptionError: onSubscriptionError,
            onDecryptionFailure: onDecryptionFailure,
            onMemberAdded: onMemberAdded,
            onMemberRemoved: onMemberRemoved,
    
            // authEndpoint: "<Your Authendpoint Url>",  Just delete this line
            
            onAuthorizer: onAuthorizer,
          );