【问题标题】:Pusher stops handling events in IOS release modePusher 在 IOS 发布模式下停止处理事件
【发布时间】:2022-01-19 13:54:35
【问题描述】:

我有一个颤振应用程序,它使用 Pusher 光束来接收消息,它在 Android 中一切正常,在 IOS 中,当我在调试模式下运行应用程序时,它像往常一样正常接收事件,即使应用程序处于前台但当我在 xcode 中以发布模式运行它它会停止在后台接收事件,并且一旦将应用程序恢复到前台,它就会接收在应用程序处于后台时发送的所有事件这是我的代码将它放在家庭中屏幕:

PusherOptions options = PusherOptions(
      auth: PusherAuth(
        url + 'broadcasting/auth',
        headers: {
          'Authorization': 'Bearer $token',
        },
      ),
      cluster: configurationModel.pusherAppCluster,
    );

    PusherClient pusher = PusherClient(
        configurationModel.pusherAppKey,
        options,
        autoConnect: false
    );

    pusher.connect();

    // Subscribe to a private channel
    Channel channel = pusher.subscribe(pusherChannel);

    // Bind to listen for events called "order-status-updated" sent to "private-orders" channel
    channel.bind(pusherEvent, (PusherEvent event) {
      _showNotificationCustomSound();
    });

【问题讨论】:

  • 你用的是哪个包?
  • 这听起来是对的。 iOS 应用程序在后台时无法保持网络连接。在 Xcode 下运行时,行为会有所不同,因为调试过程会阻止应用真正挂起。
  • @croxx5f 我正在使用 pusher_client 2.0

标签: ios flutter dart pusher pusherswift


【解决方案1】:

嗯,我去过那里。我使用了那个确切的包,它似乎不再被维护了。我做了一个叉子here。它更新了基本库的版本,如 iOS 版本、空安全和其他好东西,at github 我列出了所有所做的更改。请使用该版本并告诉我它是否能解决您的问题。

您可以将它添加到您的项目中,如下所示:

  pusher_client:
    git:
      url: https://github.com/fabiancrx/pusher_client
      ref: 7da7dddb

【讨论】:

  • 感谢您的回复 我尝试了您的fork 但不幸的是,它产生了相同的结果,似乎正如@Paulw11所说的它与设备进入时IOS关闭网络连接有关背景,我有一个 IOS 开发的朋友在项目中尝试了原生的 PusherSwift,它也没有工作
猜你喜欢
  • 1970-01-01
  • 2021-12-16
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-08-02
  • 1970-01-01
  • 2019-02-08
相关资源
最近更新 更多