它在 Android 设备上运行得很好,但我在 iOS 设备上测试时遇到了问题。具体来说,实时通信功能似乎无法在 iOS 设备上运行。
我已经做到了 iOS 特定安装# Pusher Channels Flutter 插件将 Pusher-websocket-swift cocoapod 添加到您的项目中。你可能需要运行一个
$ pod install
在ios目录下。
这是我的 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)
我也打开了这个问题pusher-channels-flutter/issues/115
authEndpoint: url
功能中删除 init
,因为它仅在网页版中使用,导致 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,
);
我遇到了同样的问题,我所做的就是
platform :ios, '12.0'
更新为 platform :ios, '13.0'
。ios
目录中,运行此 pod install
,此错误已解决。祝您编码愉快,希望这会有所帮助。