安装FCM后,Ionic 3应用程序在启动时崩溃

时间:2017-10-24 16:51:59

标签: cordova firebase ionic-framework push-notification firebase-cloud-messaging

描述

我正在从Ionic Push迁移到FCM以获取推送通知,因为前者已被声明为已弃用。在我使用here列出的说明继续安装FCM之前,应用程序运行正常(已提交并已保存)。

我安装此插件的方式与我安装的其他二十多个Cordova插件的安装方式没有任何偏差,但很明显FCM导致此问题,因为我的应用已经开始自从我安装插件以来在启动时崩溃。

尝试

我试图通过多次重新安装插件来解决此问题,但我没有运气这样做。此外,我搜索了Ionic Framework论坛,但未能找到类似的问题。如果有人有FCM的经验并且可以向我提供任何指导,我会非常感激。

注意:Cordova FCM插件文档声明它最多支持Cordova iOS 4.3.1

离子系统信息

cli packages:

    @ionic/cli-utils  : 1.14.0
    ionic (Ionic CLI) : 3.14.0

global packages:

    cordova (Cordova CLI) : 7.0.1 

local packages:

    @ionic/app-scripts : 1.3.7
    Cordova Platforms  : ios 4.3.1
    Ionic Framework    : ionic-angular 3.2.1

System:

    Android SDK Tools : 26.0.1
    Node              : v8.6.0
    npm               : 5.4.2 
    OS                : macOS Sierra
    Xcode             : Xcode 8.3.3 Build version 8E3004b 

Misc:

    backend : pro

Xcode调试输出

2017-10-24 23:33:36.693 App[9401:251001] Starting Firebase Analytics plugin
2017-10-24 23:33:36.695 App[9401] <Error> [Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add `[FIRApp configure];` (`FirebaseApp.configure()` in Swift) to your application initialization. Read more...
2017-10-24 23:33:36.719 App[9401] <Notice> [Firebase/Analytics][I-ACS023007] Firebase Analytics v.40002000 started
2017-10-24 23:33:36.720 App[9401] <Notice> [Firebase/Analytics][I-ACS023008] To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled
2017-10-24 23:33:36.747 App[9401] <Notice> [Firebase/Messaging][I-FCM001000] FIRMessaging Remote Notifications proxy enabled, will swizzle remote notification receiver handlers. Add "FirebaseAppDelegateProxyEnabled" to your Info.plist and set it to NO
2017-10-24 23:33:36.760 App[9401:251001] [CDVTimer][firebaseanalytics] 67.964017ms
2017-10-24 23:33:36.761 App[9401:251001] [CDVTimer][backgroundfetch] 0.692010ms
2017-10-24 23:33:36.762 App[9401:251001] [CDVTimer][TotalPluginStartup] 148.526013ms
2017-10-24 23:33:36.776 App[9401:251001] DidFinishLaunchingWithOptions
2017-10-24 23:33:36.793 App[9401:251001] *** Terminating app due to uncaught exception 'com.firebase.core', reason: 'Default app has already been configured.'

config.xml中

<?xml version='1.0' encoding='utf-8'?>
<widget id="..." version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
      <name>...</name>
      <description>...</description>
      <author email="..." href="">...</author>
      <content original-src="index.html" src="http://...:8100" />
      <access origin="*" />
      <access origin="https://*.google-analytics.com" />
      <access origin="https://*.googleapis.com" />
      <access origin="https://*.firebaseio.com" />
      <access origin="https://*.herokuapp.com" />
      <allow-intent href="http://*/*" />
      <allow-intent href="https://*/*" />
      <allow-intent href="tel:*" />
      <allow-intent href="sms:*" />
      <allow-intent href="mailto:*" />
      <allow-intent href="geo:*" />
      <allow-intent href="http://*/*" />
      <allow-intent href="https://*/*" />
      <allow-intent href="tel:*" />
      <allow-intent href="sms:*" />
      <allow-intent href="mailto:*" />
      <allow-intent href="geo:*" />
      <allow-navigation href="http://ionic.local/*" />
      <allow-navigation href="http://169.254.231.144:8100" />
      <allow-navigation href="http://169.254.83.211:8100" />
      <allow-navigation href="http://169.254.107.228:8100" />
      <allow-navigation href="http://169.254.217.21:8100" />
      <allow-navigation href="http://169.254.164.37:8100" />
      <allow-navigation href="http://169.254.147.106:8100" />
      <allow-navigation href="http://169.254.49.68:8100" />
      <allow-navigation href="http://169.254.124.255:8100" />
      <allow-navigation href="http://172.23.35.244:8100" />
      <allow-navigation href="http://169.254.85.129:8100" />
      <allow-navigation href="http://169.254.198.146:8100" />
      <allow-navigation href="http://169.254.198.146:8101" />
      <allow-navigation href="http://169.254.231.164:8100" />
      <allow-navigation href="http://169.254.158.202:8100" />
      <allow-navigation href="http://169.254.71.169:8100" />
      <allow-navigation href="http://192.168.1.254:8100" />
      <allow-navigation href="http://169.254.44.201:8100" />
      <allow-navigation href="http://169.254.95.130:8100" />
      <allow-navigation href="http://169.254.58.123:8100" />
      <allow-navigation href="http://169.254.63.137:8100" />
      <platform name="android">
            <allow-intent href="market:*" />
            <icon density="ldpi" src="resources/android/icon/drawable-ldpi-icon.png" />
            <icon density="mdpi" src="resources/android/icon/drawable-mdpi-icon.png" />
            <icon density="hdpi" src="resources/android/icon/drawable-hdpi-icon.png" />
            <icon density="xhdpi" src="resources/android/icon/drawable-xhdpi-icon.png" />
            <icon density="xxhdpi" src="resources/android/icon/drawable-xxhdpi-icon.png" />
            <icon density="xxxhdpi" src="resources/android/icon/drawable-xxxhdpi-icon.png" />
            <splash density="land-ldpi" src="resources/android/splash/drawable-land-ldpi-screen.png" />
            <splash density="land-mdpi" src="resources/android/splash/drawable-land-mdpi-screen.png" />
            <splash density="land-hdpi" src="resources/android/splash/drawable-land-hdpi-screen.png" />
            <splash density="land-xhdpi" src="resources/android/splash/drawable-land-xhdpi-screen.png" />
            <splash density="land-xxhdpi" src="resources/android/splash/drawable-land-xxhdpi-screen.png" />
            <splash density="land-xxxhdpi" src="resources/android/splash/drawable-land-xxxhdpi-screen.png" />
            <splash density="port-ldpi" src="resources/android/splash/drawable-port-ldpi-screen.png" />
            <splash density="port-mdpi" src="resources/android/splash/drawable-port-mdpi-screen.png" />
            <splash density="port-hdpi" src="resources/android/splash/drawable-port-hdpi-screen.png" />
            <splash density="port-xhdpi" src="resources/android/splash/drawable-port-xhdpi-screen.png" />
            <splash density="port-xxhdpi" src="resources/android/splash/drawable-port-xxhdpi-screen.png" />
            <splash density="port-xxxhdpi" src="resources/android/splash/drawable-port-xxxhdpi-screen.png" />
      </platform>
      <platform name="ios">
            <allow-intent href="itms:*" />
            <allow-intent href="itms-apps:*" />
            <icon height="57" src="resources/ios/icon/icon.png" width="57" />
            <icon height="114" src="resources/ios/icon/icon@2x.png" width="114" />
            <icon height="40" src="resources/ios/icon/icon-40.png" width="40" />
            <icon height="80" src="resources/ios/icon/icon-40@2x.png" width="80" />
            <icon height="120" src="resources/ios/icon/icon-40@3x.png" width="120" />
            <icon height="50" src="resources/ios/icon/icon-50.png" width="50" />
            <icon height="100" src="resources/ios/icon/icon-50@2x.png" width="100" />
            <icon height="60" src="resources/ios/icon/icon-60.png" width="60" />
            <icon height="120" src="resources/ios/icon/icon-60@2x.png" width="120" />
            <icon height="180" src="resources/ios/icon/icon-60@3x.png" width="180" />
            <icon height="72" src="resources/ios/icon/icon-72.png" width="72" />
            <icon height="144" src="resources/ios/icon/icon-72@2x.png" width="144" />
            <icon height="76" src="resources/ios/icon/icon-76.png" width="76" />
            <icon height="152" src="resources/ios/icon/icon-76@2x.png" width="152" />
            <icon height="167" src="resources/ios/icon/icon-83.5@2x.png" width="167" />
            <icon height="29" src="resources/ios/icon/icon-small.png" width="29" />
            <icon height="58" src="resources/ios/icon/icon-small@2x.png" width="58" />
            <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" />
            <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" />
            <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" />
            <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" />
            <splash height="1242" src="resources/ios/splash/Default-Landscape-736h.png" width="2208" />
            <splash height="1536" src="resources/ios/splash/Default-Landscape@2x~ipad.png" width="2048" />
            <splash height="2048" src="resources/ios/splash/Default-Landscape@~ipadpro.png" width="2732" />
            <splash height="768" src="resources/ios/splash/Default-Landscape~ipad.png" width="1024" />
            <splash height="2048" src="resources/ios/splash/Default-Portrait@2x~ipad.png" width="1536" />
            <splash height="2732" src="resources/ios/splash/Default-Portrait@~ipadpro.png" width="2048" />
            <splash height="1024" src="resources/ios/splash/Default-Portrait~ipad.png" width="768" />
            <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" />
            <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" />
      </platform>
      <preference name="fullscreen" value="true" />
      <preference name="ShowSplashScreenSpinner" value="false" />
      <preference name="webviewbounce" value="false" />
      <preference name="UIWebViewBounce" value="false" />
      <preference name="DisallowOverscroll" value="true" />
      <preference name="android-minSdkVersion" value="16" />
      <preference name="KeyboardDisplayRequiresUserAction" value="false" />
      <preference name="BackupWebStorage" value="none" />
      <preference name="SplashMaintainAspectRatio" value="true" />
      <preference name="FadeSplashScreenDuration" value="0" />
      <preference name="SplashShowOnlyFirstTime" value="false" />
      <preference name="SplashScreen" value="screen" />
      <preference name="SplashScreenDelay" value="1000" />
      <feature name="StatusBar">
            <param name="ios-package" onload="true" value="CDVStatusBar" />
      </feature>
      <icon src="resources/ios/icon/icon-small@3x.png" />
      <allow-navigation href="http://10.216.91.134:8100" />
      <allow-navigation href="http://10.216.154.27:8100" />
      <allow-navigation href="http://169.254.64.106:8100" />
      <allow-navigation href="http://10.60.4.249:8100" />
      <allow-navigation href="http://169.254.94.128:8100" />
      <allow-navigation href="http://10.216.84.155:8100" />
      <allow-navigation href="http://10.216.84.155:8101" />
      <allow-navigation href="http://192.168.1.254:8101" />
      <allow-navigation href="http://169.254.132.69:8101" />
      <allow-navigation href="http://172.20.10.3:8100" />
      <allow-navigation href="http://10.216.88.170:8100" />
      <allow-navigation href="http://10.216.84.170:8100" />
      <allow-navigation href="http://169.254.254.145:8100" />
      <allow-navigation href="http://169.254.211.187:8100" />
      <allow-navigation href="http://10.216.90.211:8100" />
      <allow-navigation href="http://169.254.180.116:8101" />
      <allow-navigation href="http://10.216.90.63:8100" />
      <allow-navigation href="http://10.60.5.112:8100" />
      <allow-navigation href="http://169.254.8.28:8100" />
      <allow-navigation href="http://169.254.90.171:8100" />
      <allow-navigation href="http://169.254.84.156:8100" />
      <allow-navigation href="http://169.254.30.100:8100" />
      <allow-navigation href="http://10.216.91.188:8100" />
      <allow-navigation href="http://10.60.7.23:8100" />
      <allow-navigation href="http://10.216.85.235:8100" />
      <allow-navigation href="http://169.254.39.189:8100" />
      <allow-navigation href="http://10.216.86.138:8100" />
      <allow-navigation href="http://169.254.117.243:8100" />
      <allow-navigation href="http://10.216.87.159:8100" />
      <allow-navigation href="http://169.254.127.19:8100" />
      <allow-navigation href="http://10.60.3.195:8100" />
      <allow-navigation href="http://10.216.87.58:8100" />
      <allow-navigation href="http://10.60.3.176:8100" />
      <allow-navigation href="http://169.254.223.25:8100" />
      <allow-navigation href="http://10.216.85.255:8100" />
      <allow-navigation href="http://169.254.82.147:8100" />
      <allow-navigation href="http://172.31.98.12:8100" />
      <allow-navigation href="http://10.216.86.184:8100" />
      <allow-navigation href="http://10.60.1.94:8100" />
      <engine name="ios" spec="^4.3.1" />
      <plugin name="com.telerik.plugins.nativepagetransitions" spec="~0.6.5" />
      <plugin name="cordova-plugin-app-version" spec="^0.1.9" />
      <plugin name="cordova-plugin-background-fetch" spec="^5.0.0" />
      <plugin name="cordova-plugin-badge" spec="~0.8.1" />
      <plugin name="cordova-plugin-cocoapod-support" spec="^1.3.0" />
      <plugin name="cordova-plugin-compat" spec="^1.1.0" />
      <plugin name="cordova-plugin-console" spec="^1.0.7" />
      <plugin name="cordova-plugin-contacts" spec="^2.3.1">
            <variable name="CONTACTS_USAGE_DESCRIPTION" value=" " />
      </plugin>
      <plugin name="cordova-plugin-device" spec="^1.1.6" />
      <plugin name="cordova-plugin-email-composer" spec="^0.8.8" />
      <plugin name="cordova-plugin-facebook4" spec="git+https://github.com/jeduan/cordova-plugin-facebook4.git">
            <variable name="APP_ID" value="..." />
            <variable name="APP_NAME" value="..." />
      </plugin>
      <plugin name="cordova-plugin-fcm" spec="^2.1.2" />
      <plugin name="cordova-plugin-firebase-analytics" spec="^0.10.1" />
      <plugin name="cordova-plugin-inappbrowser" spec="^1.7.1" />
      <plugin name="cordova-plugin-native-keyboard" spec="^1.4.1">
            <variable name="LICENSE" value="TRIAL" />
      </plugin>
      <plugin name="cordova-plugin-nativestorage" spec="^2.2.2" />
      <plugin name="cordova-plugin-network-information" spec="^1.3.3" />
      <plugin name="cordova-plugin-sim" spec="^1.3.3" />
      <plugin name="cordova-plugin-splashscreen" spec="^4.0.3" />
      <plugin name="cordova-plugin-statusbar" spec="^2.2.3" />
      <plugin name="cordova-plugin-vibration" spec="^2.1.5" />
      <plugin name="cordova-plugin-whitelist" spec="^1.3.2" />
      <plugin name="cordova-sms-plugin" spec="^0.1.11" />
      <plugin name="ionic-plugin-keyboard" spec="^2.2.1" />
      <plugin name="mx.ferreyra.callnumber" spec="~0.0.2" />
      <plugin name="phonegap-plugin-push" spec="^2.0.0">
            <variable name="SENDER_ID" value="..." />
      </plugin>
</widget>

期望的结果/解决方案

使用ionic cordova build ios加载我的Ionic 3应用程序而不会崩溃。

2 个答案:

答案 0 :(得分:4)

这是插件上的错误,您可以看到this issue open并显示相同的错误消息。

他应该将代码更改为:

if([FIRApp defaultApp] == nil) {
    [FIRApp configure]; 
}

我刚刚发送PR修复

答案 1 :(得分:2)

我正在回答这个问题,即使已经接受了答案,因为目前的解决方案对我没有帮助。我希望在同样的情况下帮助别人。

要修复此崩溃,我当前检查<projectRoot>/platforms/ios/<appname>/Resources/GoogleService-Info.plist<projectRoot>/platforms/ios/<appname>/Resources/Resources/GoogleService-Info.plist是否未损坏。就我而言,第二个文件已损坏,我替换为我从Firebase Cloud Messasing下载的原始文件。

然后一切都开始好起来了!