2

I have integrated the AppsFlyer SDK into my project. I have managed to get deep links working. Any links I make in OneLink will open the app as desired. However I have no way to access the link parameters. I have implemented all the following delegate methods like so:

func onAppOpenAttribution(_ attributionData: [AnyHashable : Any]!) {
    print("Test 1")
}

func onAppOpenAttributionFailure(_ error: Error!) {
    print("Test 2")
}

func onConversionDataReceived(_ installData: [AnyHashable : Any]!) {
    print("Test 3")
}

func onConversionDataRequestFailure(_ error: Error!) {
    print("Test 4")
}

Not one of them is called when my app is open from a deep link. What am I missing here? In my URL that is configured in the control panel I have mycompany:// configured as the Mobile deeplink URL. Any pointers on this would be great. Thanks!

Kex
  • 8,023
  • 9
  • 56
  • 129
  • what iOS SDK version do you use? Did you register to `delegate`? If you open app not through deep-link, `onConversionDataReceived` is called? Also please post AppsFlyer initialization – Maxim Shoustin Aug 08 '17 at 04:28
  • @MaximShoustin `onConversionDataReceived` do you know why not getting called even I have sets delegate = self – Pranavan SP Nov 04 '19 at 10:35

3 Answers3

3

If you haven't yet, please add the following method to your delegate:

// Reports app open from a Universal Link for iOS 9
- (BOOL) application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *_Nullable))restorationHandler {    
    [[AppsFlyerTracker sharedTracker] continueUserActivity:userActivity restorationHandler:restorationHandler];
    return YES;
}

This will pass the link data to the AppsFlyer Tracker and onAppOpenAttribution should be called as a result.

3

I just had to:

  1. Restart my Xcode

  2. Redownload provisioning profiles

3) Make sure you're on a real device with the Xcode project backgrounded when you click on the link.

  1. Make sure AppsFlyerTracker.shared().delegate = self is in the didFinishLaunchingWithOptions method in the AppDelegate file.
Mogsdad
  • 44,709
  • 21
  • 151
  • 275
  • When I add the 4th point, I get this error **"Cannot assign value of type 'AppDelegate' to type 'AppsFlyerTrackerDelegate!'"** – Chetan Rajagiri Jan 19 '18 at 07:19
  • 1
    Hello Chetan, please add the `AppsFlyerTrackerDelegate` to the class like so: `class AppDelegate: UIResponder, UIApplicationDelegate,` **AppsFlyerTrackerDelegate** `{` – B-Tron of the Autobots Jan 19 '18 at 21:37
1

According to the AppsFlyer document: initializing the SDK, you need to check the following conditions:

  • Invoke AppsFlyerTracker.shared.trackAppLaunch() when UIApplication.didBecomeActiveNotification posted or in the function applicationDidBecomeActive(_:).
  • Set AppsFlyerTracker.shared.isStopTracking = false
  • Pass userActivity to AppsFlyerManager.shared.continue(_) in application(_:continue:restorationHandler:) for universal link (http:// or https://).
  • Pass URL and options to AppsFlyerManager.shared.handleOpen(_:options:) in application(_:open:options:) for deep link (custom scheme).
  • Set tracker delegate to AppsFlyerTracker.shared.delegate.

After calling AppsFlyerTracker.shared.trackAppLaunch(), the callback function onAppOpenAttribution(_ attributionData:) of the delegate will pass the link information as well.

Mars
  • 179
  • 2
  • 1