Skip to content

appsFlyer.onDeepLink() Not Triggering in Kill State on iOS with Latest Version #630

@Akilramki

Description

@Akilramki

Summary:
After upgrading to React Native 0.79.0 and [email protected], the appsFlyer.onDeepLink() listener stops consistently firing in iOS kill state. It works sometimes, but most of the time it doesn't. The same implementation worked reliably in [email protected] and [email protected].

✅ Previously Working Versions
React Native: 0.71.11
AppsFlyer SDK: react-native-appsflyer@^6.12.2
In the working setup, the OneLink consistently triggered appsFlyer.onDeepLink() in:
Foreground ✅
Background ✅
Kill State ✅

📄 Universal Link (AASA) Setup
Hosted at:
https://test.onelink.me/.well-known/apple-app-site-association (sample url)
MIME Type: application/pkcs7-mime (.p7m)
AASA file verified and working correctly

Objective-C Code That Worked
AppDelegate.mm

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
   if ([RCTLinkingManager application:app openURL:url options:options]) return YES;
   [[AppsFlyerAttribution shared] handleOpenUrl:url options:options];
   return YES;
}

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler {
  [RCTLinkingManager application:application continueUserActivity:userActivity restorationHandler:restorationHandler];
  [[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler];
  return YES;
}

App.js

useEffect(() => {
  appsFlyer.onDeepLink(res => {
    console.log('onDeepLink:', res);
  });

  appsFlyer.initSdk({
    devKey: 'XXX',
    appId: '123456789',
    isDebug: true,
    onInstallConversionDataListener: true,
    onDeepLinkListener: true,
    timeToWaitForATTUserAuthorization: 10, 
  }, 
  result => console.log('SDK init success', result),
  error => console.log('SDK init error', error));
}, []);

❌ Current Setup (RN 0.79.0 + SDK 6.16.2)

🔧Affected Versions
React Native: 0.79.0
AppsFlyer SDK: react-native-appsflyer@^6.16.2
iOS Version: Tested on iOS 17.x

🧪 Current Behavior (v6.16.2 + RN 0.79.0)
Foreground: appsFlyer.onDeepLink() ✅
Background: appsFlyer.onDeepLink() ✅
Kill State: appsFlyer.onDeepLink() ❌ (Inconsistent or not firing at all)

📄 Universal Link (AASA) Setup
✅ No changes were made to the AASA configuration between the working and non-working versions.
✅ Same setup used in working version ([email protected], [email protected])
Hosted at:
https://test.onelink.me/.well-known/apple-app-site-association (sample url)
MIME Type: application/pkcs7-mime (.p7m)
AASA file verified and working correctly

Swift AppDelegate Code

AppDelegate.swift

  func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
  ) -> Bool {
    AppsFlyerLib.shared().appsFlyerDevKey = "XXX"
    AppsFlyerLib.shared().appleAppID = "123456789"
    AppsFlyerLib.shared().delegate = self
    AppsFlyerLib.shared().isDebug = true
    AppsFlyerLib.shared().start()
    return true
  }

  // iOS 9+ - Open URI Scheme
 func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    AppsFlyerLib.shared().handleOpen(url, options: options) // no return value
    let handledRCT = RCTLinkingManager.application(app, open: url, options: options)
    return handledRCT // return only the actual Bool
}


  // iOS 8 and below - Open URI Scheme
  func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
      AppsFlyerLib.shared().handleOpen(url, sourceApplication: sourceApplication, withAnnotation: annotation)
      return true
  }

  // Universal Links
func application(
  _ application: UIApplication,
  continue userActivity: NSUserActivity,
  restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void
) -> Bool {
    let handledRCT = RCTLinkingManager.application(
        application,
        continue: userActivity,
        restorationHandler: restorationHandler
    )

    AppsFlyerLib.shared().continue(userActivity, restorationHandler: nil)

    return handledRCT
}

React Native

App.js

useEffect(() => {
  appsFlyer.onDeepLink(res => {
    console.log('onDeepLink:', res);
  });

  appsFlyer.initSdk({
    devKey: 'XXX',
    appId: '123456789',
    isDebug: true,
    onInstallConversionDataListener: true,
    onDeepLinkListener: true,
    timeToWaitForATTUserAuthorization: 10, 
  }, 
  result => console.log('SDK init success', result),
  error => console.log('SDK init error', error));
}, []);

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions