首次从appstore安装应用时,Firebase动态链接无效

jer*_*rem 21 deep-linking ios firebase swift firebase-dynamic-links

我正在使用Firebase动态链接来共享我的应用程序(> = IOS 9)并邀请人们参加活动(我的意思是,如果你有应用程序,你可以加入DeepLink的活动,如果你没有它,我会在加入活动之前将您送到appstore下载应用程序).

我按照Firebase文档步骤操作:

这是我在第一次安装时获取链接的代码:

didFinishLaunchingWithOption:

    FIROptions.default().deepLinkURLScheme =  "com.jerem.ProjectAlphaSasasa"
// "com.jerem.ProjectAlphaSasasa" is my app bundle Identifier
    FIRApp.configure()
Run Code Online (Sandbox Code Playgroud)

并且基于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
}
Run Code Online (Sandbox Code Playgroud)

在我的例子中,downloadEventWithDeepLink是一个标志(全局)我在用户登录我的应用程序后检查(并在那里使用downloadUrl变量).我在设置方面做错了什么?

另外,我不知道如何调试它.有没有办法在Xcode中模拟Appstore首次安装?要确定是否调用了以前的函数(Open Url)?

谢谢你的帮助!

Ced*_*rie 0

我遇到了同样的问题,安装后未收到链接。问题是我的 url 方案设置不正确。

为了使其工作,我更改了目标的信息部分中的 URL 类型:我在标识符和 URL 方案字段中设置了包 ID。

URL方案设置

我还在 firebase 的设置代码中添加了一行:

FIRApp.configure()
FIROptions.default().deepLinkURLScheme = "fr.machin.ES5"
Run Code Online (Sandbox Code Playgroud)