【问题标题】:Cordova-plugin-firebase: Cannot run on iOS 12.2 but works without any problems on android and iOS 10.3.3Cordova-plugin-firebase:无法在 iOS 12.2 上运行,但在 android 和 iOS 10.3.3 上运行没有任何问题
【发布时间】:2019-09-01 21:37:23
【问题描述】:

Hej 伙计们

我有一个 cordova-plugin-firebase 版本的 cordova 应用程序:2.0.5。该插件在 android 和 iOS 10.3.3 上运行良好。从 firebase 和我们的通知服务器收到通知,没有任何问题。

问题出在 iOS 12 上。在 iOS 12.2 上,应用程序启动正常,运行 grantpermission 代码,并提示用户授予权限对话框,但在尝试获取令牌时如下所示:

window.FirebasePlugin.getToken(function (token) { backend_registration(token); console.log(token); }, function (error) { console.error(error); });

永远不会调用 getToken/onTokenRefresh 回调并且应用程序崩溃。如果我将用于注册应用程序以获取通知/firebase 的代码注释掉,则应用程序不会崩溃。

Cordova-cli:7.1.0 Cordova-ios:4.5.5

希望有人可以指出我的解决方案。

我还在插件 github 页面上创建了一个问题,我还附上了 xcode 日志here

【问题讨论】:

    标签: ios xcode firebase cordova cordova-plugins


    【解决方案1】:
    1. 首先我在文件 -> 项目设置中将构建系统更改为旧版。
    2. 其次,我使用了身份验证 APN 密钥(不是 Medium 指南中提到的证书,请参阅 https://firebase.google.com/docs/cloud-messaging/ios/certs)。
    3. 添加到 config.xml

      <platform name="ios">
       <config-file target="*-Info.plist" parent="UIBackgroundModes">
        <array>
          <string>remote-notification</string>
        </array>
       </config-file>
      </platform>
      

    这为我解决了问题。

    【讨论】:

      猜你喜欢
      • 2016-11-04
      • 2021-10-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-07
      • 2018-07-25
      • 1970-01-01
      • 2011-06-30
      相关资源
      最近更新 更多