Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deferred link always return nil #1694

Closed
5 tasks done
julioarregoitia opened this issue Mar 18, 2021 · 5 comments
Closed
5 tasks done

Deferred link always return nil #1694

julioarregoitia opened this issue Mar 18, 2021 · 5 comments
Labels

Comments

@julioarregoitia
Copy link

julioarregoitia commented Mar 18, 2021

Checklist

Environment

Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:

  • Xcode Version: 14.2
  • Swift Version: 5.7.2 (if issue is Swift related) NO
  • Installation Platform & Verison: SPM

Goals

Get the url of the deferred link and open then app in some section like I do with Firebase

Expected Results

Get the url of the deferred link

Actual Results

The url is always nil

Steps to Reproduce

What are the steps necessary to reproduce this issue?
Very simple to describe:
1- Login to your facebook
2- Then Click https://developers.facebook.com/tools/app-ads-helper
2- Select an app you want to test from drop down
3- Hit submit
4- At the bottom you will find 'Deep Link Tester' under Developer Tools.
5- Hit 'Test Deep Link' and in the dialog you can enter your deep link.
6- Select both 'Send Notification' and 'Send Deferred' check marks.
7- Then you will get a notification to your facebook app.
8- Tap in the notification and it is opened the App Store
9- Install the App through Xcode

Code Samples & Details

Then in my code I tried all this variants:

I tried this:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {

        // Set the trackings to true in test mode
        Settings.setAdvertiserTrackingEnabled(true)
        Settings.isAdvertiserIDCollectionEnabled = true
        Settings.isAutoLogAppEventsEnabled = true

        // Initialize the Facebook SDK
        ApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)

        Settings.shared.isAdvertiserIDCollectionEnabled = false
        Settings.shared.isAdvertiserTrackingEnabled = false
        Settings.shared.isAutoLogAppEventsEnabled = false
}

Then on the primary ViewController:

class SomePrimaryViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        setupUI()
    }

    @available(iOS 14.5.1, *)
    private func presentTransparencyMode() {
        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)
                
                // Get the Deferred link
                 DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
                    self.setupDefferedLink()
                }

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

    private func setupDefferedLink() {
     
        // Set the trackings to true in test mode
        Settings.shared.isAdvertiserIDCollectionEnabled = true
        Settings.shared.isAdvertiserIDCollectionEnabled = true
        Settings.shared.isAutoLogAppEventsEnabled = true

        let id = ASIdentifierManager.shared().advertisingIdentifier.uuidString
        let request = GraphRequest(graphPath: "/971082983006874/activities", parameters: ["event": "DEFERRED_APP_LINK",
                                                                                          "advertiser_id": id,
                                                                                          "application_tracking_enabled": "1",
                                                                                          "advertiser_tracking_enabled": "1"], httpMethod: .post)
        
        request.start { [unowned self] connection, result, error in
            if let result = result as? NSDictionary {
                print(result as Any)
                // It prints a dictionary with a key `success` with  value `true` 
                // and nothing about the url
            }
        }
        
        AppLinkUtility.initialize()
        AppLinkUtility.fetchDeferredAppLink { (url, error) in
            if let url = url {
                print(url)
            }
            print(error as Any)
            // It prints:
            // ATTrackingManager.AuthorizationStatus must be `authorized` for deferred deep linking to work. Read more at:         https://developer.apple.com/documentation/apptrackingtransparency
           // That is an Error of the SDK, because the permission has been granted
        }
        
    }

}

No matter which variant you try, the result is always the same, url = nil

@Toni77777
Copy link

I have the same issue, url is nil always

@julioarregoitia
Copy link
Author

Apparently the issue it's with IDFA that always is 00000000-0000-0000-0000-000000000000, hopefully when this problem is solved this issue disappear:
https://developers.facebook.com/support/bugs/349628616375797/

@github-actions
Copy link

github-actions bot commented Jun 8, 2023

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the Stale label Jun 8, 2023
@github-actions
Copy link

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@sulizhan
Copy link

I have the same problem, how did you solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants
@sulizhan @Toni77777 @julioarregoitia and others