I'm trying to calling the Deferred Deeplinking of Facebook with the function:
AppLinkUtility.fetchDeferredAppLink { (url, error) in ... }
I am taking the user permission consent alert before calling the deferred deeplinking method
func applicationDidBecomeActive(_ application: UIApplication) {
if #available(iOS 14, *) {
ATTrackingManager.requestTrackingAuthorization { (status) in
switch status {
case .authorized:
// Tracking authorization dialog was shown
// and we are authorized
print("Authorized")
// Now that we are authorized we can get the IDFA
print(ASIdentifierManager.shared().advertisingIdentifier)
DispatchQueue.main.async {
self.fetchDeferredDeeplink()
}
case .denied:
// Tracking authorization dialog was
// shown and permission is denied
print("Denied")
case .notDetermined:
// Tracking authorization dialog has not been shown
print("Not Determined")
case .restricted:
print("Restricted")
@unknown default:
print("Unknown")
}
}
}
}
func fetchDeferredDeeplink(){
Settings.shared.isAdvertiserTrackingEnabled = true
Settings.shared.isAdvertiserIDCollectionEnabled = true
Settings.shared.isAutoLogAppEventsEnabled = true
ApplicationDelegate.shared.initializeSDK()
AppLinkUtility.fetchDeferredAppLink { (url, error) in
if let url = url {
print(url)
}
print(error as Any)
}
}
Add Below keys to info.plist
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>**Your URL Scheme** </string>
<string>**Your FB app id** </string>
</array>
</dict>
</array>
The result is always the same, url = nil. I have tried all the ways and followed many blogs
I'm using:
Xcode Version: 12.4 Swift Version: 5.2 Installation Facebook SDK: 14.1.0