I am working on receiving firebase dynamicLinks. In restorationHandler method of App delegate, I have called DynamicLinks.dynamicLinks().handleUniversalLink(url) method of Firebase DynamicLinks to get the the actual link from shortlink. But in callback of this method I am receiving nil in dynamiclink. So, I am unable to get the url from dynamic link received in callback. Can anyone please help me to figure this out why it is returning nil.
func application(_ application: UIApplication, continue userActivity: NSUserActivity,
restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
if let incomingURL = userActivity.webpageURL {
// it prints the passed url and working fine
debugPrint("Imcoing Url is: \(incomingURL.absoluteString)")
let linkHandled = DynamicLinks.dynamicLinks().handleUniversalLink(incomingURL) { (dynamicLink, error) in
guard error == nil else {
debugPrint("Error Found: \(error!.localizedDescription)")
return
}
//
//
if let dynamiclink = dynamicLink, let _ = dynamiclink.url {
// but below function call is not called beacause dynamicLink coming in
// callback is nil
self.handleIncomingDynamicLink(dynamiclink)
}
}
if linkHandled {
return true
} else {
// do other stuff to incoming URL?
return false
}
}
return false
}