iOS - Unable to reach 3rd instance of firebase project via FCM - ios

I have 3 different Firebase projects that are initialized in a single application. The first app is initialized using the default GoogleService-info.plist file.
The first two projects contain a Firebase iOS app with the same bundle id as the app. The third project contains an iOS app with an arbitrary bundle id.
I develop an SDK that uses Firebase to provide push notification service, and utility silent push functionality. The use case I describe here is one where the client app has its own Firebase project, the SDK has a client dedicated project, and another "Master" Firebase project that is used as the utility-cross-client Firebase project.
While FCM can reach the app via the first two projects (The ones with the same bundle id) it cannot reach the app via the third one (the cross-client one) due to invalid-apns-credentials error. Note that I generate the fcmToken correctly using Messaging.messaging().retrieveFCMToken(forSenderID::) and that the same APNs auth key is used throughout all 3 projects.
I tried to solve it by adding a new Firebase app to the third project with the same bundle id as the application, and which allowed me be able to reach the application. However, I was still able to reach the client app even after I've delete the Firebase iOS app from the 3rd project (the one with the same bundle id not the "arbitrary one")

Related

Simulate application installation from app store to collect ad campaign data

I need to extract advertisement campaign data on the first application launch using AppsFlyer, specifically source(pid) and campaign(c). I'm doing it using AppsFlyer SDK methods according to the guide. To debug the solution I'm making TestFlight package and referencing it with link like:
https://testflight.apple.com/join/some-id?pid=test&c=testCompaign
But neither pid nor c is passed to the app when I install the app using this link.
How can I debug pid/c to be sure it will be passed to the app at the production?

How to get a Tracking_ID in Google Analytics for iOS apps for Google Tag Manager usage?

I've set up my account in Google Analytics, Google Tag Manager and have already installed firebase/analytics and GoogleTagManager to my project...
The problem is when I go the admin section and click on the default property created for my app I have no Tracking_ID on property settings menu,
the property is set as app + web I've tried to set a new property as App it then gives me only a .plist and no Tracking_ID for managing the events on Google Tag Manager...
Is google tag manager a tool meant to be used only for web now?
Because I installed it on iOS but it seems GA doesn't provide Tracking_ID for mobile tracking and without Tracking_ID I just can't use GTM...
Any help on this matter would be highly appreciated,
Thank you all in advance)
GA App properties were sunsetted and are now app+web properties.
In GA for the Property you created, you also need to add a data stream. App+Web Properties use a Measurement ID, not a Tracking ID.
When you add an app data stream, Analytics creates a corresponding
Firebase project and app data stream, and automatically links the
Firebase project to your property if your project and property are not
already linked. Currently, you cannot link to an existing Firebase
project from Analytics.
Enter the iOS bundle ID or Android package name, the app name, and for
iOS, the App Store ID, then click Register app.
Analytics will progress through the steps of creating a Google Cloud
project, a Firebase project, linking the Firebase project to
Analytics, and creating the app stream. Click Next.
Follow the instructions to download the config file for your app. Click Next.
Follow the instructions to add the Firebase SDK to your app. Click Next.
Run your app to verify installation of the SDK and that the app is communicating with Google servers. Click Finish.
Alternatively, click Skip this step if you want to complete app setup
at a later time. Click Next.
Ref: https://support.google.com/analytics/answer/9304153
GTM also has two new tags in it - GA App+Web Configuration tag & GA App+Web Event.

Firebase dynamic link not opening correct app when multiple flavors are installed on iOS

We developed a flutter app for Android and iOS, with different flavors: dev, test and prod, so we have 6 apps in total. To on-board the user, we send a firebase dynamic link via Email (with a deep link inside it) to navigate the user to a specific screen when it is tapped.
The expected behavior is that when the user taps on a dynamic link of - say - the dev app, it opens a screen in the dev app. Similar for the other flavors.
Now this works just fine on Android.
On iOS it works fine if only one app is installed, but if for example the dev and the test apps are installed, then tapping on the dynamic links always opens the test app. This is also true when dev, test and prod are installed: test is opened.
This is a development issue and not relevant for production as the user will never have the test or dev app installed, but it is annoying us as we have to uninstall and reinstall flavors all the time.
Our dynamic links have the following format (values in '<>' are placeholders):
Dev: https://<app_id>.page.link/?link=http://dev.<mydomain>.com/reset?token=token1&apn=<mypackage>.dev&isi=<isiNumber1>&ibi=<mypackage>.dev
Test: https://<app_id>.page.link/?link=http://test.<mydomain>.com/reset?token=token2&apn=<mypackage>.test&isi=<isiNumber2>&ibi=<mypackage>.test
Prod: https://<app_id>.page.link/?link=http://<mydomain>.com/reset?token=token3&apn=<mypackage>&isi=<isiNumber3>&ibi=<mypackage>
The behavior is the same for all iOS versions I could get my hands on on real devices, i.e. iOS 11, 12 and 13.
We're using Flutter 1.9.1-hotfix6 and firebase_dynamic_links 0.5.0+1
Any ideas what this might be caused by?
Firebase Dynamic Links do not support using the same URL prefix for multiple iOS apps/targets contained in the same Firebase project.
You can workaround this in multiple ways though:
Using multiple (sub)domains (as already suggested by Janmenjaya)
Use a custom domain
Using multiple Firebase projects (as already suggested by Aleksandr)
On Android it works out of the box, because you are in charge of matching paths with particular apps within the Manifest file. On iOS it doesn't work, because Firebase is in charge of such matches within the hosted apple-app-site-association file.
For further information, I've written an extensive answer here.
Do not use one project in the firebase console, it is better to split and use different url in <key>com.apple.developer.associated-domains</key>
In Firebase under dynamic link, we can create multiple url domain. And these url domain we need to add in the associated domain of different target.
Steps
Let’s assume I have two target test and production.
I created two domain link like “test.page.link” and production.page.link
In test target in Xcode under Signing & Capabilities -> Associated Domain, use the “test.page.link”
And for production target set the production.page.link

Firebase Analytics events on iOS - test and production

The iOS app I am working on uses Firebase Analytics to report events. It works as expected, but the app is not in production yet. Once it is it would be preferable to have the events logged by real users separate from these logged when debugging.
What is the best way to have Firebase Analytics events logged separately for test and production?
First you will probably want to create a separate Firebase project for staging/debug.
Then you will have to configure your app to be able to use different resources based on build type. For Android we solved this using build flavors, not sure what the iOS equivalent is.
From docs (https://firebase.google.com/docs/projects/multiprojects):
By default, FirebaseApp.configure() will load the GoogleService-Info.plist file bundled with the application. If your development and production environments are configured as separate targets in XCode, you can:
Download both GoogleService-Info.plist files
Store the two files in different directories
Add both to your XCode project
Associate the
different files with the different targets using the Target
Membership panel.
If the builds are part of a single target, the best option is to give both configuration files unique names (e.g. GoogleService-Info-Free.plist and GoogleService-Info-Paid.plist). Then choose at runtime which plist to load.

Add Fabric app (Twitter) without Xcode

I have this situation: I need to build my app on the command line, but I need to make changes too. (The tool I would be using is Fastlane).
I could enter the api keys externally, but the question is: How do I create a Fabric app without opening Xcode?
Thanks!
If you already have a Fabric account, all you need is the organisation API key. On the first launch of a new app, the app will automatically be created on Fabric.

Resources