59

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?

dacoinminster
  • 3,637
  • 2
  • 18
  • 23
kalpeshdeo
  • 1,236
  • 1
  • 11
  • 16

22 Answers22

31

sometimes we make a mistake in Associated Domains entitlements. There have to be no spaces

applinks:mydomain.page.link
protspace
  • 2,047
  • 1
  • 25
  • 30
  • Thank you! For those, who want more details how to enable that: https://developer.apple.com/documentation/xcode/supporting-associated-domains – Vladimir Obrizan Nov 20 '22 at 17:21
22

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 ). Settings Developer

ViktoR
  • 691
  • 9
  • 11
  • I worked for me. In my case it was redirecting to my website and after to apple store. It fixed my problem. – fct May 04 '21 at 18:10
21

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!

Heinrisch
  • 5,835
  • 4
  • 33
  • 43
17

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.

  1. 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."
  2. As pointed out by another answer, verify that your team ID is properly set in the Firebase console.
  3. 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

iamthearm
  • 513
  • 2
  • 15
  • would you mind posting a link to your assoc. file at .app.goo.gl/apple-app-site-association please? Also, please copy/paste your strings in "Associated Domains" – iamthearm Jul 11 '16 at 21:44
  • Found solution even if really strange..There was something dirty in the Apple Member Center AppID/Provisioning profile..I've created them again starting from scratch and now it works. – wildmonkey Jul 12 '16 at 09:55
  • Great! It is true that the Associated Domains entitlement is required for Universal Links to function. – iamthearm Jul 15 '16 at 20:30
  • @iamthearm for third point is there any way to open an app evrytime when user clicks on the link? – nitish005 Jun 24 '17 at 12:03
  • @nitish005 In iOS 8 and prior, the custom scheme is used (user click -> Safari -> JS opens custom scheme -> target app opens) - This should open the app every time. In iOS 9+, FDL relies on Universal Links to open the app directly from the user click; as a consequence of this, FDL is constrained by the limitations of iOS Universal Links and may not open the app every time depending on what actions the user has taken. – iamthearm Jul 02 '17 at 18:21
  • Which app_id should you use for checking the apple-app-site-association? I've tried the firebase and the apple one and none of them work – syonip Oct 11 '20 at 09:29
15

Just in case there is still someone out there having this issue, please note the following

  1. Dynamic links now opens on simulator, please copy your link and paste on safari in your emulator.

  2. 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.

  3. 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 enter image description here

  • Ensure Associated domain is turned on in your apple developer account enter image description here

  • if you are using a custom domain, ensure you add it to the info.plist as shown below.enter image description here

knig_T
  • 1,916
  • 16
  • 16
  • Where can you find Associated domains in the developer account? – Nick Morhun Feb 09 '22 at 09:14
  • 1. visit https://developer.apple.com/account, 2. click on certificates, identifiers and profiles. 3. select identifiers 4. Select your app identifier 5. you should see your app's capabilities from there. You can do this from Xcode as well – knig_T Feb 10 '22 at 09:46
  • Plus 1 for the custom domain, I was missing it – Omarj Dec 24 '22 at 14:13
  • Did you mean only PAID developer account can setup associate domain?? Did you mean dynamic link only work for PAID developer account ?? – Oktaheta Jan 23 '23 at 00:14
  • My problem was the last point, thanks for the help :D – Remoo Jan 30 '23 at 13:18
11

I make a mistake that not setup Associated Domains for DEBUG, so make sure you setup Associated Domains all both DEBUG & RELEASE

enter image description here

Tai Le
  • 8,530
  • 5
  • 41
  • 34
7

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.

icould
  • 315
  • 3
  • 9
  • Yes it seems to be fixed. But I used programatic dynamic link creation inside my code. Although I did wrote same parameters like in Firebase, it works now in both chrome and safari. – icould Jul 25 '17 at 13:10
6

If none of the above workarounds work for you, please check if you have added activitycontinuation in associated domains or not.

Followin image shows the exact place where you have to add that(if you havn't done that already)

3

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).

dacoinminster
  • 3,637
  • 2
  • 18
  • 23
  • 1
    What if I don't have anything for SomethingElse? just on the format com.domain.appname? It does not accept empty Team ID.. – Murat Yasar Mar 20 '17 at 12:06
  • I have the same problem, I don't have any SomethingElse and format is just com.domain.appname. Could you find any solution for that? – she hates me May 12 '19 at 23:05
2

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.

Vladimir Grigorov
  • 10,903
  • 8
  • 60
  • 70
2

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.

Iris Veriris
  • 448
  • 5
  • 7
2

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

ataravati
  • 8,891
  • 9
  • 57
  • 89
Jackson Smith
  • 576
  • 4
  • 14
2

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>
Fuad All
  • 871
  • 11
  • 13
1

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.

Pankaj Jangid
  • 812
  • 9
  • 18
1

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)
        }
    }

}

1

Set on your Xcode project the correct form to declare Associated Domain, you must to include applinks:

enter image description here

Edimar Martins
  • 2,631
  • 1
  • 9
  • 10
0

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.

Johan Franzén
  • 2,355
  • 1
  • 17
  • 15
0

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;

enter image description here

ali ozkara
  • 5,425
  • 2
  • 27
  • 24
0

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/

zeiteisen
  • 7,078
  • 5
  • 50
  • 68
0

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:

  1. Copy the link and paste it into the notes app
  2. Long press on the link in notes to see context menu
  3. If you see button "Open in YourAppName" - try pressing it.
Mikhail Vasilev
  • 720
  • 6
  • 13
0

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.

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 21 '21 at 08:30
-1

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.

Sat Mandir Khalsa
  • 547
  • 1
  • 5
  • 7