【问题标题】:Firebase on Cordova doesn't trigger notifications on iOS DevicesCordova 上的 Firebase 不会在 iOS 设备上触发通知
【发布时间】:2019-04-17 12:29:34
【问题描述】:

我正在使用 Cordova 为 iOS ed Android 制作应用程序。 我已经安装了这个插件:phonegap-plugin-push 并且可以在 Android 上运行。 所以关于 iOS,我已经将 Firebase 项目中的 che 证书安装到控制台中。 事实上,当我尝试运行测试通知时,我看到了这个:

关联的 17 个应用用户是我对令牌通信所做的测试。 该证书是从苹果开发者控制台创建的 .p8 证书,我认为我所做的是正确的,因为我们可以在 firebase 控制台上看到设备注册:

该项目也有豆荚:

Analyzing dependencies
Downloading dependencies
Using FirebaseAnalytics (4.2.0)
Using FirebaseCore (4.0.20)
Using FirebaseInstanceID (2.0.10)
Using FirebaseMessaging (2.0.8)
Using GoogleToolboxForMac (2.1.4)
Using Protobuf (3.6.1)
Using nanopb (0.3.901)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 7 total pods installed.

关于 Xcode 功能:

所以问题是,为什么在 iOS 上通知不起作用?有什么建议?为什么没有触发设备? 我使用 Visual Studio Code,项目在 Apache Cordova 上。

【问题讨论】:

    标签: ios firebase cordova firebase-cloud-messaging cordova-plugin-fcm


    【解决方案1】:

    构建此插件需要 Xcode 8.0 或更高版本。

    CocoaPods

    Required cordova-cli minimum version: 6.4.0
    
    Required cordova-ios minimum version: 4.3.0
    
    Required CocoaPods minimum version: 1.0.1
    

    要安装 CocoaPods,请按照安装说明here。安装 CocoaPods 后,请运行:

    pod setup
    

    如果您使用 npm 安装此插件,并且您使用的是 6.1.0 或更高版本的 cordova-cli,它将自动为您的平台和 cli 下载此插件的正确版本。

    如果您使用的 cordova-cli 版本低于 6.1.0,则必须升级您的 cordova-cli 版本,或显式安装插件:

    cordova plugin add phonegap-plugin-push@1.8.1
    

    如果您在 Xcode 中打开应用程序并收到如下错误:

    ld: 找不到 -lPods-Appname 的库 clang:错误:链接器命令失败,退出代码为 1

    Then you are opening the .xcodeproj file when you should be opening the .xcworkspace file.
    

    如果你使用的是最新版本的 o xcode (10),如果你使用 ionic 3,你需要以这种方式构建

    ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
    

    此答案的来源 --> here

    【讨论】:

    • 我已经安装了 CocoaPods 并按照您链接中的教程进行了询问。无论如何,您的解决方案不起作用
    • 好的,您是否在 Cordova 的 config.xml 中包含以下内容? <platform name="ios"> <resource-file src="GoogleService-Info.plist" /> </platform>
    猜你喜欢
    • 2019-04-12
    • 2023-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多