简体   繁体   English

首次从应用商店安装应用时,Firebase 动态链接不起作用

[英]Firebase Dynamic Link doesn't work when installing app from appstore for the first time

I'm using Firebase Dynamic Link to share my app (>=IOS 9) and invite people to events (I mean if you have the app you can join the event with the DeepLink and if you don't have it, I'll be sending you to the appstore to download the app before joining the event).我正在使用 Firebase Dynamic Link 来分享我的应用程序(> = IOS 9)并邀请人们参加活动(我的意思是,如果您拥有该应用程序,您可以使用 DeepLink 加入该活动,如果您没有它,我会在参加活动之前将您发送到应用程序商店下载应用程序)。

I follow the Firebase docs step:我遵循 Firebase 文档步骤:

  • I'm getting the relevant JSON at https://app_code.app.goo.gl/apple-app-site-association .我在https://app_code.app.goo.gl/apple-app-site-association获得了相关的 JSON。
  • If my app is installed, the DeepLink is working great.如果安装了我的应用程序,DeepLink 运行良好。
  • If my app isn't installed , the Deeplink send you to the appstore, but when opening for the first time, it doesn't work and you can't join the event.如果我的应用没有安装,Deeplink 会把你送到应用商店,但是第一次打开时,它不起作用,你不能参加活动。

Here is my code for getting the link on first install:这是我在首次安装时获取链接的代码:

in didFinishLaunchingWithOption :didFinishLaunchingWithOption

    FIROptions.default().deepLinkURLScheme =  "com.jerem.ProjectAlphaSasasa"
// "com.jerem.ProjectAlphaSasasa" is my app bundle Identifier
    FIRApp.configure()

and based on Firebase docs, on first opening, I'm using the following functions:并基于 Firebase 文档,在第一次打开时,我使用了以下功能:

//MARK: First entry
//when your app is opened for the first time after installation on any version of iOS.
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
    print("00000000000000000")
    FIRCrashMessage("Link during first installation")
    downloadEventWithDeepLink = true
    downloadUrl = url
    return application(app, open: url, sourceApplication: nil, annotation: [:])

}

//same as previous but for older version ios 8 (not relevant)
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
    let dynamicLink = FIRDynamicLinks.dynamicLinks()?.dynamicLink(fromCustomSchemeURL: url)
    if let dynamicLink = dynamicLink {

        downloadEventWithDeepLink = true
        downloadUrl = dynamicLink.url
        return true
    }

    return false
}

In my case, downloadEventWithDeepLink is a flag (global) I check after user's login to my app (and use there the downloadUrl variable).在我的情况下, downloadEventWithDeepLink是一个标志(全局),我在用户登录到我的应用程序后检查(并在那里使用 downloadUrl 变量)。 What am I doing wrong with the setup?我的设置有什么问题?

Also, I don't know how to debug it.另外,我不知道如何调试它。 Is there a way to simulate an Appstore first install in Xcode?有没有办法在 Xcode 中模拟 Appstore 的首次安装? To find out if the previous functions (Open Url) are called?查明是否调用了之前的函数(Open Url)?

Thanks for your help!谢谢你的帮助!

I think to test your implementation is by deleting the app and clicking on the link, once it takes you to the App Store, you don't install the app from there and instead install from Xcode, you should receive the dynamic link call.我认为通过删除应用程序并单击链接来测试您的实现,一旦它带您进入 App Store,您就不会从那里安装应用程序,而是从 Xcode 安装,您应该收到动态链接调用。

As a recommendation, don't worry too much about that, you should focus on testing that your dynamic link does open the app if its installed.作为建议,不要太担心,您应该专注于测试您的动态链接是否在安装后打开了应用程序。 test that it works when the app has launched and when it was closed.测试它在应用程序启动和关闭时是否有效。

If your having issues redirecting to your app, check that you have registered your bundle identifier in the url types and added your domain as applinks:your_dynamic_links_domain in the capabilities tab.如果您在重定向到您的应用程序时遇到问题,请检查您是否已在 url 类型中注册了您的包标识符,并在功能选项卡applinks:your_dynamic_links_domain您的域添加为applinks:your_dynamic_links_domain If you're using a custom domain, you also have to register it into your info.plist.如果您使用自定义域,则还必须将其注册到 info.plist 中。

I have never set the FIROptions.default().deepLinkURLScheme variable in my projects and all of them work fine我从来没有在我的项目中设置FIROptions.default().deepLinkURLScheme变量,它们都工作正常

I had the same problem with link not getting received after install.我有同样的问题,安装后没有收到链接。 The problem was that my url scheme wasn't correctly setup.问题是我的 url 方案没有正确设置。

To make it work I changed the URL types in the Info part of my target : I set the bundle ID in identifier and URL schemes field.为了使其工作,我更改了目标的信息部分中的 URL 类型:我在标识符和 URL 方案字段中设置了包 ID。

URL 方案设置

I also add a line in my setup code of firebase :我还在我的 firebase 设置代码中添加了一行:

FIRApp.configure()
FIROptions.default().deepLinkURLScheme = "fr.machin.ES5"

暂无
暂无

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

相关问题 未安装应用时,Firebase 动态链接不会打开 Appstore - Firebase dynamic link won't open Appstore when the app is not installed Firebase动态链接在iOS上不起作用 - Firebase dynamic link doesn't work on iOS application:openURL:options:从Firebase动态链接按应用程序安装后首次打开应用程序时未调用 - application:openURL:options: not called when first time app open after app installation from Firebase dynamic link pressing Firebase 动态链接未在开发应用程序中打开,而应用程序不在应用商店中 - Firebase dynamic link not open in development app while app is not in appstore Firebase动态链接无法从iOS中的Facebook帖子导航到ios app / appstore - Firebase dynamic link does not navigate to ios app/ appstore from facebook post in iOS 从应用商店安装应用后,创建应用安装链接即可保留 - Create app installation link to persist after installing app from appstore 快速地以编程方式创建的firebase动态链接不起作用,没有域 - firebase dynamic link created programmatically in swift doesn't work, no domain Firebase 动态链接在 IOS 15+ 上无法正常工作 - Firebase Dynamic link doesn't work correctly on IOS 15+ 对于某些不支持NFC的设备,如何限制从App Store安装ios App? - How to restrict installing ios app from appstore for some of the devices which doesn't support NFC? 应用重新安装并首次启动后,Firebase 消息传递不起作用 - Firebase messaging doesn't work after app reinstall and launch first time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM