gpt4 book ai didi

iOS swift : Firebase Dynamic Links: Short URL not working

转载 作者:行者123 更新时间:2023-11-28 06:10:37 25 4
gpt4 key购买 nike

我在我的 iOS 应用中使用深层链接

customAppScheme://openID#ID=12345

这表示打开一个特定的项目页面。

我想使用相同的作为动态链接的一部分。

使用自定义 URL 生成器

长网址:https://<myCode>.app.goo.gl/?ibi=com%2Ecompany%2EmyAPP&ius=customAppScheme%3A%2F%2FopenID%23ID%3D12345&isi=1234567890&imv=1%2E0&ifl=https%3A%2F%2Fgoogle%2Ecom&link=https%3A%2F%2Fgoogle%2Ecom

绝对网址:https://<myCode>.app.goo.gl/?ibi=com.company.myAPP&ius=customAppScheme://openID#ID=12345&isi=1234567890&imv=1.0&ifl=https://google.com&link=https://google.com

短网址:https://<myCode>.app.goo.gl/aHS1Vq5RZYL6kGR02

链接:https://google.com

构建 ID:“com.company.myAPP”

自定义方案:“customAppScheme://openID#ID=12345”

如果我使用长 URL,它可以正常工作。 (我在笔记中添加链接并单击链接。)该应用程序打开并转到给定的项目页面。

但是当我使用短 URL 时,应用程序会打开,但之后没有其他任何东西。它不会转到项目页面。

PFB 我的应用委托(delegate)方法。

func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
guard let dynamicLinks = DynamicLinks.dynamicLinks() else {
return false
}

let handled = dynamicLinks.handleUniversalLink(userActivity.webpageURL!) { (dynamiclink, error) in

if let dynamiclinkURL = userActivity.webpageURL, let urlComponents = URLComponents(url: dynamiclinkURL, resolvingAgainstBaseURL: true) {

if let queryItems = urlComponents.queryItems {

queryItems.forEach { queryItem in

if let value = queryItem.value, queryItem.name == "ius" {
handelLink(url: value)
}

}

}

}
}


return handled
}

此方法非常适合长 url。但对于短网址,这不起作用。如果我做错了什么或遗漏了什么,请告诉我。

提前致谢。

最佳答案

请确保短链接与长链接具有相同的参数。要比较链接,请导航到每个链接的调试页面。将 d=1 参数附加到链接的末尾以获取调试页面的 URL。短链接调试页面为 https://<myCode>.app.goo.gl/aHS1Vq5RZYL6kGR02?d=1 ,长链接为 https://<myCode>.app.goo.gl/?ibi=com%2Ecompany%2EmyAPP&ius=customAppScheme%3A%2F%2FopenID%23ID%3D12345&isi=1234567890&imv=1%2E0&ifl=https%3A%2F%2Fgoogle%2Ecom&link=https%3A%2F%2Fgoogle%2Ecom&d=1

关于iOS swift : Firebase Dynamic Links: Short URL not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46839313/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com