单击动态链接时深层链接不包含有效的必需参数

ami*_*apa 8 ios firebase swift firebase-dynamic-links xcode10

我已将动态链接设置为文档,但单击链接时它显示:

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/";
Run Code Online (Sandbox Code Playgroud)

}

单击动态链接时应用程序打开,但它不调用任何函数并显示错误如何知道链接是否被单击?

我用选项方法完成了午餐:

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
Run Code Online (Sandbox Code Playgroud)

和文档中的函数:

@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
}
Run Code Online (Sandbox Code Playgroud)

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

Mar*_*kov 2

如果您使用长版本的深层链接打开应用程序,您应该确保您的link值是百分比编码的,这样&,?,=内部链接内的符号就会被 Firebase 编码并正确处理。