简体   繁体   English

Firebase 动态链接打不开app iOS

[英]Firebase dynamic link not opening the app iOS

I have developed & installed an iOS app locally on my device.我已经在我的设备上本地开发并安装了一个 iOS 应用程序。

And have set custom scheme in the info.plist as mydlink并在 info.plist 中将自定义方案设置为mydlink

Set associated domains as weel: applinks:<myapp>.app.goo.gl将关联域设置为 weel: applinks:<myapp>.app.goo.gl

Created dynamic link on firebase as:在 firebase 上创建动态链接为:

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.当我打开或单击动态链接时,它会在“App Store”应用程序中打开应用程序页面,但不会打开应用程序本身,尽管它已安装。

What am I missing here?我在这里错过了什么?

If you are on iOS 9, universal links will be used.如果您使用的是 iOS 9,则将使用通用链接。 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)如果您尝试在设备上的 safari 中直接打开链接(将其输入到浏览器的地址字段中)

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'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+;对于 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. Dynamic Links 依赖 Apple 的 Universal Links 在 iOS 9+ 上打开应用程序,这些建议旨在解决 Universal Links 和 Firebase 的问题,与 SDK 没有直接关系。

  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."在 https:// app_id .app.goo.gl/apple-app-site-association 验证 assoc 文件是否正确 - 它应该类似于https://maps.app.goo.gl/apple-app-site -association但在“细节”中只有一个元素。
  2. As pointed out by another answer, verify that your team ID is properly set in the Firebase console.正如另一个答案所指出的,请验证您的团队 ID 是否在 Firebase 控制台中正确设置。
  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.如果您长按链接然后单击“在 Safari 中打开”,或者在应用程序通过通用链接打开后单击了应用程序状态栏上的“goo.gl>”按钮,则 iOS 默认为打开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.这可以通过下拉在 Safari 中打开的分页并单击智能横幅上的“在应用程序中打开”(或类似内容)来解决。

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. “ibi”参数不参与在 iOS 9+ 上的安装后点击中打开应用程序,但在未设置“ius”参数的早期版本中。

Regarding iOS 8, can you try running the app and then clicking a link after the app is installed?关于iOS 8,您可以尝试运行该应用程序,然后在安装该应用程序后单击链接吗? On versions prior to iOS 9, you can test by copy/pasting the link into safari.在 iOS 9 之前的版本上,您可以通过将链接复制/粘贴到 safari 中进行测试。

https://firebase.google.com/docs/dynamic-links/ios https://firebase.google.com/docs/dynamic-links/ios

sometimes we make a mistake in Associated Domains entitlements.有时我们会在关联域权限中出错。 There have to be no spaces必须没有空格

applinks:mydomain.page.link

Just in case there is still someone out there having this issue, please note the following以防万一仍有人遇到此问题,请注意以下事项

  1. Dynamic links now opens on simulator, please free to copy your link and paste on safari in your emulator.动态链接现在在模拟器上打开,请随意复制您的链接并粘贴到模拟器中的 safari。
  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. Chrome 和 safari 的动态打开方式不同,safari 只使用通用链接,而 chrome 使用 url scheme 和通用链接打开动态链接。 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.如果您的动态链接路由到 App Store 而不是打开您的应用程序。 there is an issue with your universal link.您的通用链接有问题。 You can temporarily test using chrome.您可以暂时使用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确保您的团队 id 设置正确 在 firebase 控制台中,从https://developer.apple.com 中的会员详细信息中获取您的团队 id

    • 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.如果您使用的是自定义域,请确保将其添加到 info.plist 中,如下所示。 在此处输入图片说明

I experienced same problem.我遇到了同样的问题。 Interestingly if you open the dynamic link in Chrome, app starts directly and successfully.有趣的是,如果您在 Chrome 中打开动态链接,应用程序将直接成功启动。 But in Safari always it tries to open AppStore although the app is installed.但是在 Safari 中,尽管安装了该应用程序,它还是会尝试打开 AppStore。 I have no idea why Safari doesn't work in this case.我不知道为什么 Safari 在这种情况下不起作用。

I make a mistake that not setup Associated Domains for DEBUG, so make sure you setup Associated Domains all both DEBUG & RELEASE我犯了一个错误,没有为 DEBUG 设置关联域,所以请确保您设置了所有 DEBUG 和 RELEASE 的关联域

在此处输入图片说明

I had an issue using iOS 14, running on device in debug mode.我在使用 iOS 14 时遇到问题,在调试模式下在设备上运行。 Link has always redirected me to the AppStore app not to my app. Link 总是将我重定向到 AppStore 应用程序而不是我的应用程序。 The solution was to enable "Associated Domains Development" on iPhone Settings>Developer>Associated Domains Development (found it here: https://stackoverflow.com/a/63939770/6689321 ).解决方案是在 iPhone Settings>Developer>Associated Domains Development 上启用“Associated Domains Development”(在此处找到: https : //stackoverflow.com/a/63939770/6689321 )。 设置 开发商

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.由于 Firebase 在设置过程中的假设存在问题,Firebase 动态链接对我们不起作用(在 iOS9 上,它们使用通用链接)。 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在将您的 iOS 应用添加到 Firebase 控制台项目设置时,Firebase 会要求您提供“团队 ID”,并且它假定您的唯一应用 ID 的格式为 TeamID.com.foo.bar

However, in our case, that was NOT our unique app ID.然而,在我们的例子中,这不是我们唯一的应用程序 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当我查看我们的配置文件时(在 developer.apple.com 上我找到了我们的配置文件并单击了“编辑”),我看到我们唯一的应用程序 ID 实际上是 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.我不得不进入 Firebase 控制台并在它要求输入团队 ID 的地方输入“SomethingElse”,即使那不是我们的团队 ID。 Once I made that change, Firebase Dynamic Links started working correctly.做出更改后,Firebase 动态链接开始正常工作。

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. Firebase 似乎假设您的唯一应用 ID 将始终以您的团队 ID 开头,但显然情况并非总是如此。

Note that changing your Team ID can take a significant amount of time to take effect.请注意,更改您的团队 ID 可能需要很长时间才能生效。 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 ).您可以通过检查 app_id 的相应链接 ( https://app_id.app.goo.gl/apple-app-site-association ) 来查看更改已发生。

If none of the above workarounds work for you, please check if you have added activitycontinuation in associated domains or not.如果上述解决方法都不适合您,请检查您是否在关联域中添加了活动继续。

下图显示了您必须添加的确切位置(如果您还没有这样做)

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.集成 Firebase 动态链接后,示例链接立即在装有 iOS 8 的设备上开始工作。对于 iOS 9 设备,使用通用链接机制,如其他答案所述。 This means Apple needs to update the entitlement data used to verify deep link dual authentication.这意味着 Apple 需要更新用于验证深度链接双重身份验证的授权数据。 This may take 48 hours, according to Apple's App Search API Validation Tool .根据 Apple 的App Search API 验证工具,这可能需要 48 小时。

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标识符 -> 应用 ID -> 'my.app.ID' -> 前缀

You can find it on: https://developer.apple.com/account/ios/identifier/bundle您可以在以下位置找到它: 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.而不是我使用的.pbxproj中的'DevelopmentTeam'编号, .pbxproj其添加到 Firebase 控制台中我的 iOS 应用程序的Team ID

And don't forget to download and add a new .plist to the project.并且不要忘记下载并将新的 .plist 添加到项目中。

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但是现在我们可以在模拟器上测试 firebase 动态链接

https://stackoverflow.com/a/56385506/6273003 https://stackoverflow.com/a/56385506/6273003

When link is open in safari, It shows a "open (project name)"button.在 safari 中打开链接时,它会显示一个“打开(项目名称)”按钮。 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.如果按住此按钮 2-3 秒,它会要求首次将其打开到不同的应用程序中。它还显示您的应用程序名称。 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.这样做之后,如果您再次打开此链接并在 safari 中按下按钮,它总是可以正常工作。

This fixed the problem for me.这为我解决了问题。

i had same issue with latest flutter sdk and firebase dynamic links plugin.我对最新的 flutter sdk 和 firebase 动态链接插件有同样的问题。

Tried all solutions the only fix was to manually insert com.apple.developer.associated-domains key to ios/Runner/Running.entitlements file尝试了所有解决方案,唯一的解决方法是手动将com.apple.developer.related-domains键插入ios/Runner/Running.entitlements文件

<key>com.apple.developer.associated-domains</key>
<array>
  <string>applinks:abc.page.link</string>
</array>

After completing the setup in Firebase and in the Xcode project.在 Firebase 和 Xcode 项目中完成设置后。

Add below code inside SceneDelegate instead AppDelegate.在 SceneDelegate 中添加以下代码而不是 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:在您的 Xcode 项目上设置正确的表格来声明关联域,您必须包含应用链接:

在此处输入图像描述

Make sure you have a Team Id set in the firebase console for you app.确保您在 Firebase 控制台中为您的应用设置了团队 ID。 (you will then need to download and import the .plist file). (然后您需要下载并导入 .plist 文件)。

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.在我们的案例中,问题是生成带有链接的电子邮件的软件生成了一个新链接,该链接具有指向我们深层链接的 304 重定向。 This did not work in Safari (but in Chrome).这在 Safari 中不起作用(但在 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;我有同样的情况,它在deeplink url上定义了ios应用程序后修复;

Dynamic Links -> choose your link -> Edit

make sure that you have defined ios app;确保您已经定义了 ios 应用程序;

在此处输入图片说明

I had the problem, that the AASA file was different at the locations我遇到了问题,AASA 文件在不同的位置不同

[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.对于 Firebase,请检查您的托管并在公共目录中搜索 .well-known 文件夹。 In my case, I could just delete it, run firebase deploy --only hosting and let Firebase generate all AASA files for me.就我而言,我可以删除它,运行firebase deploy --only hosting并让 Firebase 为我生成所有 AASA 文件。

https://branch.io/resources/aasa-validator/ 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:如果你确定你在 xcode 中的所有动态链接配置​​都是正确的,链接是好的,但它仍然打开 Appstore,你可以试试这个技巧:

  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.如果您看到“在YourAppName 中打开”按钮 - 尝试按下它。

please check associated domains as well: applinks:.app.goo.gl is correct or not?请同时检查相关域:applinks:.app.goo.gl 是否正确? and Dynamic link is easily work on iOS Simulater, I don't get any issues.动态链接很容易在 iOS 模拟器上工作,我没有遇到任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 打开 iOS 应用程序后“continue userActivity:”方法未被调用 - Firebase 动态链接 - After opening iOS app "continue userActivity:" method isn't called - Firebase dynamic link Firebase 从 Instagram 访问时动态链接未打开应用程序 - Firebase Dynamic Link not opening app when access from Instagram Firebase 动态链接在 IOS 上不起作用 - Firebase dynamic link is not working on IOS Flutter iOS Firebase 带链接值的动态链接推送命名页面 - Flutter iOS Firebase dynamic link push named page with the link value 我们可以在第一次使用 Firebase 动态链接安装应用程序后检索动态 URL 吗? 如果是,那么如何? (斯威夫特/iOS) - Can we retrieve the Dynamic URL after the first time app installation using Firebase Dynamic Link? if yes, then how? (Swift/iOS) iOS 在应用程序处于非活动状态时处理动态链接 - iOS handle dynamic link while app is inactive Android:Firebase 动态链接在打开应用程序之前先打开浏览器 - Android: Firebase Dynamic Links open browser first before opening app Firebase 动态链接在 IOS 15+ 上无法正常工作 - Firebase Dynamic link doesn't work correctly on IOS 15+ 从 Firebase 动态链接 iOS 获取用户添加的参数 - Get user-added parameter from Firebase Dynamic Link iOS Firebase 动态链接未导航到 iOS 上的深层链接 - Firebase Dynamic Links doesn't navigate to deep link on iOS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM