我已将我的动态链接设置为文档,但是在单击链接时显示:
Deep Link does not contain valid required params. URL params: {
"_cpb" = 1;
"_cpt" = cpit;
"_fpb" = "CJsFEPcCGgVlbi1VUw==";
"_iumchkactval" = 1;
"_iumenbl" = 1;
"_osl" = "https://ttnfleetsolutions.page.link/azrN2YkJQncowdQ78";
"_plt" = 3698;
"_uit" = 1651;
apn = "com.ttnfleetsolutions.ttnfleet.debug";
cid = 4103105643708739955;
ibi = "com.ttnfleetsolutions.ttnfleetCustomer";
link = "https://www.ttnfleetsolutions.com/";
}
单击动态链接后,应用程序已打开,但未调用任何功能,并显示错误如何知道是否单击了链接?
我的didfinishlunchingwithoption方法:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool{
IQKeyboardManager.shared.enable = true
FirebaseApp.configure() UIBarButtonItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.clear], for: .normal)
UIBarButtonItem.appearance().setTitleTextAttributes([NSAttributedString.Key.foregroundColor: UIColor.clear], for: UIControl.State.highlighted)
GMSServices.provideAPIKey(GOOGLE_API_KEY)
GMSPlacesClient.provideAPIKey(GOOGLE_API_KEY)
return true
} 和功能从文档:
@available(iOS 9.0, *)
func application(_ app: UIApplication, open url: URL, options:
[UIApplication.OpenURLOptionsKey : Any]) -> Bool {
return application(app, open: url,
sourceApplication:
options[UIApplication.OpenURLOptionsKey.sourceApplication] as?
String,
annotation: "")
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
if let dynamicLink = DynamicLinks.dynamicLinks().dynamicLink(fromCustomSchemeURL: url) {
print("DynamicLink\(dynamicLink)")
return true
}
return false
}
和
extension AppDelegate {
func application(_ application: UIApplication,
continue userActivity: NSUserActivity,
restorationHandler: @escaping ([Any]?) -> Void) ->
Bool {
guard
userActivity.activityType == NSUserActivityTypeBrowsingWeb,
let webpageURL = userActivity.webpageURL else {
return false
}
return
DynamicLinks.dynamicLinks().handleUniversalLink(webpageURL) {
dynamiclink, error in
guard let url = dynamiclink!.url else { return }
print("url:", url)
}
}
}
答案 0 :(得分:1)
如果您使用深层链接的长版版本打开应用程序,则应确保对link
值进行百分比编码,这样,内部链接中的&,?,=
符号就会被编码并正确处理通过firebase。