[英]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 文档步骤:
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。
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.