How to transfer a firebase dynamic link to a newly installed application? - ios

Everything I say pertains to ios 9 and above.
Firebase documentation says:
When a user opens one of your Dynamic Links, if your app isn't yet
installed, the user is sent to the Play Store or App Store to install
your app (unless you specify otherwise), and your app opens. You can
then retrieve the link that was passed to your app and handle the link
as appropriate for your app.
I succeeded to install my application by FB-link and to open my installed application by the link. But when I try install and open in single step the application is opened without link passed. That is if my application already installed and I click on the link then the application is opened with link passed. But if application is not installed and I click on FN-link then iOS open AppStore and install the application and then I click on 'open' button and the application is opened without links. I am sorry for my bad English but hope that you are understanding me.
UPDATE
I've seen same similar question and question.
Check points.
Application starts (openURL is executed) by custom schema url (in my case it is same as bundle id)
Application starts (continueUserActivity is executed) by dynamic link.
I tryed to use cellular instead of wi-fi without success.
If application not installed taping on dynamic link open AppStore with my app.
In didFinishLaunchingWithOptions I call [FIRApp configure].
Nothing helped.
I didn't say that I use Xamarin and Xamarin FireBase
May be it uses the old version of native FireBase library.
SOLVED!
Xamarin Firebase plugin has been updated and problem have been solved.

Let me suggest how to test the Firebase Dynamic Links on iOS in the case when the iOS App is not installed.
Remove the iOS App from iPhone (ensure to use actual device, not Simulator);
Generate Firebase Dynamic Link and paste the link to the iOS Notes App;
Tap on the link in Notes App;
Ensure that you see Interstitial page, where you tap on "Open" button. After this you should be navigated to Apple AppStore;
Put breakpoint or NSLog to [UIApplicationDelegate application:openURL:options:] and observe the url value;
Install and launch the App using Xcode;
Shortly after App is launched you should observe call to the [UIApplicationDelegate application:openURL:options:] with url. Here you will call:
FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks]
dynamicLinkFromCustomSchemeURL:url];
If Firebase Dynamic Link is found you should see dynamicLink.url property being non-nil. If Firebase Dynamic Link not found, you will see dynamicLink.url property being nil.
When this scenario working well, you can re-check FDL behavior in Safari, Facebook, Email and other apps.
If App is already installed, then tapping on Firebase Dynamic Link should launch the App with the link. Watch out for [UIApplicationDelegate application:continueUserActivity:restorationHandler:], value userActivity.webpageURL.

I was able to solve this issue on my end without any code changes, and by simply running pod update and updating to the latest version of Firebase.

Related

My flutter iOS app hasn't been released yet. How can I know my firebase dynamic link works to open Appstore if the app isn't installed yet?

I have set up Firebase deep link that will open the Flutter app if it's installed and will open Google Playstore or iOS Appstore respectively if the app isn't installed.
So far, the dynamic link successfully opens the app page in Google Appstore in its internal testing mode (because it's still in internal testing).
But when I tried to test the deep link on iOS device, it shows a Firebase page that says "Save my place in the app. A link will be copied to continue to this page." From my experience, this is the page Firebase showed when the deep link failed.
When I tapped the button, it indeed shows the Firebase link failed.
My question is, is this indeed about Firebase base deep link failed, or is it because the app is not released yet on iOS Appstore?
I have set Bundle ID, Appstore ID, and Team ID on the Firebase Apple app. The apple-app-site-association is set up properly from Firebase.
{"applinks":{"apps":[],"details":[{"appID":"TEAMID.com.app.bundle","paths":["NOT /_/*","/*"]}]}}
The problem is I cannot publish the app first and then experiment based on that app publish whether the link actually works or not. When the app is published, the link must already work. So I cannot test it beforehand. But I have a feeling the deep link failed, as I think the deep link should open Appstore even though the Appstore will display "Product not found" or similar.
Not sure if you still have this issue. I think for the first screen you missing the isi parameter, the second screen maybe caused by you didn't encode the URL

react-native iOS App receives firebase dynamic links when run in debug scheme but not when run in release scheme

I have integrated the dynamic links sdk using react-native firebase. I tested the deep links by opening the url by tapping on them in a text message which lead to a screen displaying my apps name and the information along with the open button. Tapping the open button took me to the app store's page for my application. I then installed the app using xcode in a debug scheme. The dynamic link was received correctly and everything worked fine. I then did the same process but changed the scheme to release. This time the url received was unfortunately null. I have debugged the native code as well and can see that dynamicLinkFromCustomSchemeURL:url contains the correct deep link in debug scheme but not in release scheme.

Firebase Dynamic Links not survive installation

I have went through the Firebase Tutorial, I have implemented Firebase SDK + Dynamic links + Managed my app to support Associated Domains and everything works fine except that the dynamic link doesn't survive the installation.
I have created a dynamic link through Firebase console,
When app already installed, everything works fine. The dynamic link launch my app with the relevant content
When my app isn't installed, the dynamic link open the AppStore as expected and than I'm installing the app through Xcode, but nothing happens I don't receive any content on first launch.
What I did:
Make sure that the Scheme URL in Xcode -> Targets -> MyAPP -> Info -> URL Types is the same as my app Bundle Identifier.
Make sure that under my FireBaseURL/apple-app-site-association the content is fine:
{"applinks":{"apps":[],"details":[{"appID":"MyTeamID.com.foo.bla","paths":["/*"]}]}}
Make sure that I defined in AppDelegate
I have tried do define in the AppDelegate [FIROptions defaultOptions].deepLinkURLScheme = #"com.foo.bla"
Make sure that under associated Domains there are no extra '/' or something. My Supported domain is applinks:FireBaseURL.
Double check that the TeamID that defined in the Firebase console is the same as my application TeamID.
Of-course I have searched a-lot in StackOverFlow without any success to find a solution that worked for me.
Any suggestions?
UPDATE
OK, so I found that somehow I'm using an old version of the Firebase SDK, so I updated the Firebase SDK + start working on the cellular instead of the Wi-Fi and everything works like a charm.
Thanks to #Oleksiy Ivanov
#MKaro Can you add logging to your UIApplicationDelegate method application:openURL:options: and print out is there link passed to your App after first launch? If link is found it will be passed here. When Firebase Dynamic Links failed to retrieve the link, still there will be call to this method with "dismiss" link (this is poorly documented). If you do not see any calls to this method after first launch, this means Firebase Dynamic Links is misconfigured.
Another thing to watch out, Firebase Dynamic Links will check for pending dynamic link only after first install. You have to remove the App to force retrieving the link.
It may be worthwhile to try the first install scenario on WiFI vs Cellular. Type of the network may affect this.

Firebase dynamic link not opening the app iOS

I have developed & installed an iOS app locally on my device.
And have set custom scheme in the info.plist as mydlink
Set associated domains as weel: applinks:<myapp>.app.goo.gl
Created dynamic link on firebase as:
https://<myapp>.app.goo.gl/?link=http://<mysite.com>/&ibi=<app bundle id>&ius=mydlink&ifl=https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id%3D<app store id>%26mt%3D8&pt=<app store id>
When I open or click on dynamic link, it opens app page in the "App Store" app and not opening app itself though its installed.
What am I missing here?
sometimes we make a mistake in Associated Domains entitlements. There have to be no spaces
applinks:mydomain.page.link
If you are on iOS 9, universal links will be used. Universal links don't work in a lot of cases, like:
If you use a simulator
If you try to open the link directly in safari on a device (typing it into the address field in the browser)
I spent a lot of time trying this and could never get it to work on a simulator in a reliable way. What I end up doing is emailing the link to me and opening it from Inbox. Then it works every time!
I had an issue using iOS 14, running on device in debug mode.
Link has always redirected me to the AppStore app not to my app.
The solution was to enable "Associated Domains Development" on iPhone Settings>Developer>Associated Domains Development
(found it here: https://stackoverflow.com/a/63939770/6689321 ).
I'm sorry for the late reply - I hope your issue has been resolved and that this is helpful to others who may be experiencing the same problem.
There could actually be one or more issues here for iOS 9+; Dynamic Links relies on Apple's Universal Links to open the app on iOS 9+ and these suggestions are aimed at resolving issues with Universal Links and Firebase and have nothing to do with the SDK directly.
Verify that the assoc file is correct at https://app_id.app.goo.gl/apple-app-site-association - it should look similar to https://maps.app.goo.gl/apple-app-site-association but with only one element in "details."
As pointed out by another answer, verify that your team ID is properly set in the Firebase console.
If you've long-pressed the link and then clicked "Open in Safari" or you have clicked the "goo.gl>" button on the status bar of your app after the app opens via a Universal Link, then iOS defaults to opening Universal Links in Safari. This can be fixed by pulling down on the paged opened in Safari and clicking "Open in App" (or similar) on the smart banner.
The "ibi" parameter is not involved in opening the app in a post-install click on iOS 9+, but is in prior versions when the "ius" param is not set.
Regarding iOS 8, can you try running the app and then clicking a link after the app is installed? On versions prior to iOS 9, you can test by copy/pasting the link into safari.
https://firebase.google.com/docs/dynamic-links/ios
Just in case there is still someone out there having this issue, please note the following
Dynamic links now opens on simulator, please copy your link and paste on safari in your emulator.
Chrome and safari opens dynamic differently, safari uses only universal linking while chrome uses both url scheme and universal linking to open dynamic link. Ultimately you should try to get dynamic linking opening via universal link in your app.
If your dynamic link routes to App Store instead of opening your app. there is an issue with your universal link. You can temporarily test using chrome.
To set up opening dynamic link via universal link, please check the following
Ensure your Team id is correctly set In firebase console, get your team id from your membership detail in https://developer.apple.com
Ensure your domain is listed in your associated domain as shown below, no space between the domain
Ensure Associated domain is turned on in your apple developer account
if you are using a custom domain, ensure you add it to the info.plist as shown below.
I make a mistake that not setup Associated Domains for DEBUG, so make sure you setup Associated Domains all both DEBUG & RELEASE
I experienced same problem. Interestingly if you open the dynamic link in Chrome, app starts directly and successfully. But in Safari always it tries to open AppStore although the app is installed. I have no idea why Safari doesn't work in this case.
If none of the above workarounds work for you, please check if you have added activitycontinuation in associated domains or not.
Firebase dynamic links were not working for us (on iOS9 where they use universal links) due to a problem in Firebase's assumptions during setup. Here's how we fixed the problem on our app:
Firebase asks for your "Team ID" when adding your iOS app to Firebase Console Project Settings, and it assumes that your unique app ID will be in the format TeamID.com.foo.bar
However, in our case, that was NOT our unique app ID. When I looked at our provisioning profile (on developer.apple.com I found our provisioning profile and clicked "edit"), I saw that our unique app ID was actually SomethingElse.com.foo.bar
I had to go into Firebase Console and enter that "SomethingElse" in the spot where it asked for Team ID, even though that was NOT our team ID. Once I made that change, Firebase Dynamic Links started working correctly.
It appears Firebase is making an assumption that your unique app ID will always start with your Team ID, which is apparently not always the case.
Note that changing your Team ID can take a significant amount of time to take effect. You can see that the change has happened by checking the appropriate link for your app_id (https://app_id.app.goo.gl/apple-app-site-association).
After integrating Firebase Dynamic links, the sample link started working immediately on a device with iOS 8. For iOS 9 devices Universal links mechanism is used, as mentioned by other answers. This means Apple needs to update the entitlement data used to verify deep link dual authentication. This may take 48 hours, according to Apple's App Search API Validation Tool.
There are more Universal links troubleshooting tips here.
Experienced the same problem.
The solution for me was to use the
Identifiers -> App IDs -> 'my.app.ID' -> Prefix
You can find it on: https://developer.apple.com/account/ios/identifier/bundle
Instead of the 'DevelopmentTeam' number from the .pbxproj which I used and add it to the Team ID for my iOS app in the Firebase console.
And don't forget to download and add a new .plist to the project.
i had same issue with latest flutter sdk and firebase dynamic links plugin.
Tried all solutions the only fix was to manually insert com.apple.developer.associated-domains key to ios/Runner/Running.entitlements file
<key>com.apple.developer.associated-domains</key>
<array>
<string>applinks:abc.page.link</string>
</array>
I have great news.
I always hear that it's IMPOSSIBLE to test a dynamic link on simulator.
But now WE CAN test firebase dynamic link on simulator
https://stackoverflow.com/a/56385506/6273003
When link is open in safari, It shows a "open (project name)"button. If this button is pressed for 2-3 second, It asks for opening that into different apps for first time.It also shows your app name. If you select your app, It opens your app. After doing that if you again open this link and press button in safari, it always work fine.
This fixed the problem for me.
After completing the setup in Firebase and in the Xcode project.
Add below code inside SceneDelegate instead AppDelegate.
func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
if let incomingURL = userActivity.webpageURL {
print("Incoming URL is \(incomingURL)")
let linkHandled = DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { (dynamicLink, error) in
guard error == nil else{
print("Found an error! \(error!.localizedDescription)")
return
}
if let dynamicLink = dynamicLink {
self.handleIncomingDynamicLink(dynamicLink)
}
}
}
Set on your Xcode project the correct form to declare Associated Domain, you must to include applinks:
Make sure you have a Team Id set in the firebase console for you app. (you will then need to download and import the .plist file).
This fixed the problem for me.
We had a similar problem. The issue in our case was that the software that generated the emails with the links generated a new link that had a 304-redirect to our deep link. This did not work in Safari (but in Chrome).
Check that your deep link is actually the first link opened when you click the link in the email.
i had same case and it fixed with after defined ios app on deeplink url;
Dynamic Links -> choose your link -> Edit
make sure that you have defined ios app;
I had the problem, that the AASA file was different at the locations
[domain]/.well-known/apple-app-site-association
[domain]/apple-app-site-association
The validator from branch always checks the file on the non well known path. It was confusing because it always said it was all fine even though is was not.
For Firebase, check your hosting and search in the public dir for a .well-known folder. In my case, I could just delete it, run firebase deploy --only hosting and let Firebase generate all AASA files for me.
https://branch.io/resources/aasa-validator/
If you are sure all your dynamic links config in xcode is correct, link is good, but it still opens Appstore you can try this trick:
Copy the link and paste it into the notes app
Long press on the link in notes to see context menu
If you see button "Open in YourAppName" - try pressing it.
please check associated domains as well: applinks:.app.goo.gl is correct or not? and Dynamic link is easily work on iOS Simulater , I don't get any issues.

Retrieving a deep link when the app isn't installed (iOS)

In the iOS docs for Google App Invites, under Receiving Invitations, it is suggested that a deep link can be retrieved on first launch if the app wasn't installed in advance:
If the user has not yet installed the app, the user can choose to
install the app from the iTunes App Store. When the app opens for the
first time, the App Invites SDK will supply a deeplink if one is
available.
I've looked through the reference docs for GINInvite and GINReceivedInvite but I don't see any way to instantiate GINReceivedInvite outside of an application openURL call. Anybody know how to actually have the SDK retrieve the deep link in this scenario?
What you are trying I will say is not the correct way. You have to check in Safari web browser if app is install or not. If not navigate to App store
You can find your solution in here How to check if an app is installed from a web-page on an iPhone?

Resources