简体   繁体   中英

How to open the app when user tap on the firebase dynamic link

I have a dynamic link: https://test.app.goo.gl/name and I've added this to associated domains: test.app.goo.gl. In the info in URLTypes section, I've added URL Scheme: com.project.lad When I press on the dynamic link, I can see window with "open in app button", but when tap on this button, opens the website not the app.

you need to follow the document provided to receive a dynamic link that will open in your app - https://firebase.google.com/docs/dynamic-links/ios/receive

if you followed documents properly then try to add the following code in SceneDelegate.swift file. it might help.

func scene(_ scene: UIScene, continue userActivity: NSUserActivity) {
 if let incomigURL = userActivity.webpageURL{
            _ = DynamicLinks.dynamicLinks().handleUniversalLink(incomigURL) { (dynamiclink, error) in
                if let dynamiclink = dynamiclink, let _ = dynamiclink.url {
                    self.handleIncomingDynamicLink(dynamicLink: dynamiclink)
                } else {
                    print("dynamiclink = nil")
                }
            }
}



 func handleIncomingDynamicLink(dynamicLink: DynamicLink){
        print("Your dynamic link parameter is = \(String(describing: dynamicLink.url))")
       
        let link = dynamicLink.url?.absoluteString
       //your code
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM