On iOS 14 using SwiftUI, I'm currently trying to test Dynamic Links in the situation where the user clicks the link and installs the app, then opens it up and receives information from that link. I followed the recommendations in this post (How can I test Firebase Dynamic Links if my app is not in the App Store?) and also implemented all the AppDelegate functions on the Firebase iOS website.
However, nothing gets called when I open the link, install the app, and then open the app for the first time (It just says "Pasted from Safari"). The only thing that works is clicking Dynamic links when the app is already installed (it opens up the app and calls the url listener functions correctly).
This is the code for generating the link:
let dynamicLink = URL(string: "http://www.mydomainishereIjustremovedit.com/?referrer=\(referrerID)")!
//guard let uid = Auth.auth().currentUser?.uid else { return }
if let referralLink = DynamicLinkComponents(link: dynamicLink, domainURIPrefix: "https://penciltestapp.page.link") {
referralLink.iOSParameters = DynamicLinkIOSParameters(bundleID: "com.penciltestapp.penciltestapp")
//referralLink.iOSParameters?.minimumAppVersion = "1.0"
referralLink.iOSParameters?.appStoreID = "962194608" // Opens up a random app on the app store. Just click this to open the app store, and then install your app from XCode
referralLink.shorten { (shortURL, warnings, error) in
if let error = error {
print(error.localizedDescription)
return
}
self.inviteURL = shortURL
}
}