Facebook 延迟深度链接在 iOS 中总是返回 url 为 nil (14+)

Facebook Deferred Deeplinking is always returning url is nil in iOS (14+)

提问人:Venky Siddani 提问时间:9/3/2023 更新时间:9/3/2023 访问量:62

问:

我正在尝试使用以下函数调用 Facebook 的延迟深度链接:

 AppLinkUtility.fetchDeferredAppLink { (url, error) in ... } 

在调用延迟深度链接方法之前,我正在接收用户权限同意警报

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)
    }

}

将以下键添加到 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>

结果始终相同,url = nil。我尝试了所有方法并关注了许多博客

我正在使用:

Xcode 版本:12.4 Swift版本:5.2 安装 Facebook SDK:14.1.0

iOS Swift Facebook 延迟深度链接

评论


答: 暂无答案