Reputation: 11
In the app that we're building, we need Firebase Dynamic Link, because the Sign Up is with Firebase email link login. This login will send an email to the provided email address, that when clicked, will open the app with a dynamic link. To keep our users engaged, we also like to send Push Notifications. I can get both of them to work together on Android when I use the versions by chemerisuk on GitHub. I even get an iOS build, but I get stuck on getting a token on iOS. Getting this error message:
Failed to fetch default token Error Domain=com.firebase.iid Code=1003 "(null)"
I've double checked my Firebase Project settings (bundle id, app id prefix, cloud messaging sender id, cloud messaging apn key) and my Apple settings (certificates, provisioning profiles, keys and identifiers). I've tried it on Simulators and Real Devices. I've tried Development builds, App Store Archives and Ad Hoc Archives.
Unfortunately, Dynamic Links isn't included in the Cordova Firebase plugin. When I try to add a different fcm plugin, it includes the complete Firebase Core, which conflicts with Dynamic Links.
I feel like I'm really close, who has any experience with this combination of plugins and got it working on iOS?
This is my environment:
Ionic:
ionic (Ionic CLI) : 4.0.2 (/usr/local/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.8
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0, ios 4.5.5
System:
Android SDK Tools : 26.1.1
ios-deploy : 1.9.2
ios-sim : 6.1.2
NodeJS : v8.11.3 (/usr/local/bin/node)
npm : 5.6.0
OS : macOS High Sierra
Xcode : Xcode 9.4.1 Build version 9F2000
Environment:
ANDROID_HOME : /Users/user/Library/Android/sdk/
My (relevant) Cordova config.xml:
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="com.example.android" android-versionCode="10001" id="com.example.app" ios-CFBundleIdentifier="com.example.ios" ios-CFBundleVersion="1.0.1" version="1.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Example</name>
<description>Some description</description>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="ScrollEnabled" value="false" />
<preference name="BackgroundColor" value="0xff168aa5" />
<preference name="android-minSdkVersion" value="16" />
<preference name="BackupWebStorage" value="none" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="FadeSplashScreenDuration" value="300" />
<preference name="Orientation" value="portrait" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
<allow-intent href="market:*" />
<icon />
<splash />
</platform>
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon />
<splash />
</platform>
<plugin name="cordova-plugin-whitelist" spec="^1.3.3" />
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.2" />
<plugin name="cordova-plugin-ionic-webview" spec="^1.2.1" />
<plugin name="cordova-plugin-ionic-keyboard" spec="^2.1.2" />
<plugin name="cordova-plugin-x-socialsharing" spec="^5.4.1" />
<plugin name="cordova-plugin-qrscanner" spec="^2.6.0" />
<allow-navigation href="http://192.168.178.19:8101" />
<plugin name="cordova-plugin-firebase-dynamiclinks" spec="^1.0.0">
<variable name="APP_DOMAIN" value="example.com" />
<variable name="PAGE_LINK_DOMAIN" value="ab123.app.goo.gl" />
<variable name="FIREBASE_DYNAMIC_LINKS_VERSION" value="+" />
</plugin>
<plugin name="cordova-plugin-firebase-messaging" spec="^1.1.0">
<variable name="FIREBASE_MESSAGING_VERSION" value="17.1.+" />
<variable name="ANDROID_SUPPORT_VERSION" value="27.+" />
</plugin>
<engine name="android" spec="7.0.0" />
<engine name="ios" spec="4.5.5" />
</widget>
Upvotes: 0
Views: 1917
Reputation: 11
Because I was using only parts of the Firebase library, I didn't include Firebase Analytics, because I wasn't using it. Apparently, it's necessary for the functioning of the rest of the plugins. So installing cordova-plugin-firebase-analytics
was the fix for me.
For some, it was making sure that they had the correct Firebase project settings. Go to Firebase > Cloud messaging > iOS app configuration and make sure you've uploaded a valid APNs Authentication Key or APNs Certificates.
Hope this helps other people who want to use both Firebase Messaging AND Firebase Dynamic Links!
Upvotes: 1