Partial Outageshare-external
Deferred deeplinks returning nil on iOS
1

SDK version: 17.0.0

As the title implies, I'm getting nil for deferred deeplinks on iOS when using the below piece of code. I've verified that the IDFA is not all zeroes. The deeplink I'm trying to match should look like the following:

appName://app/deeplink-path?queryParameter1=queryParameterValue1

However, I'm unable to fetch any sort of parameters (in particular, I'm able to fetch the target_url on Android, which is what I'm expecting on iOS as well)

    override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: LaunchOptions?) -> Bool {
        ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }

    override func applicationDidBecomeActive(_ application: UIApplication) {
        if #available(iOS 14, *) {
            ATTrackingManager.requestTrackingAuthorization { [weak self] status in
                switch status {
                case .authorized:
                    Settings.shared.isAdvertiserTrackingEnabled = true
                    Settings.shared.isAdvertiserIDCollectionEnabled = true
                    self?.fetchDeferredAppLink()
                default:
                    Settings.shared.isAdvertiserTrackingEnabled = false
                    Settings.shared.isAdvertiserIDCollectionEnabled = false
                }
            }
        } else {
            self.fetchDeferredAppLink()
        }

        return super.applicationDidBecomeActive(application)
    }

    func fetchDeferredAppLink() {
        let idfa = ASIdentifierManager.shared().advertisingIdentifier
        print("IDFA: \(idfa)")
        AppLinkUtility.initialize()
        AppLinkUtility.fetchDeferredAppLink { [weak self] uri, err in
            if let err = err {
                print("FBSDK (error): \(err)")
            }

            if let uri = uri {
                print("FBSDK (uri): \(uri)")

                let params = ["+non_branch_link": "\(uri)"]
                self?.handler.sendEvent(params)
            }
        }
    }
Justin
Asked about a month ago