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

[iOS 14.5] onDeepLink no triggered #295

Open
lucasroca opened this issue May 20, 2021 · 31 comments
Open

[iOS 14.5] onDeepLink no triggered #295

lucasroca opened this issue May 20, 2021 · 31 comments

Comments

@lucasroca
Copy link

Report

onDeepLink handler not being called in iOS 14.5

Plugin Version

"react-native": "0.64.1"
"react-native-appsflyer": "6.2.41"

On what Platform are you having the issue?

iOS

What did you do?

I updated to Xcode 12.5 and tested opening a deep link on iOS 14.5, and it didn't trigger onDeepLink. The handler is working fine on iOS 14.4 and 13.5.
I tried adding timeToWaitForATTUserAuthorization: 10, but it didn't help.

export const initAppsFlyer = () => {
  const onDeepLinkCanceller = appsFlyer.onDeepLink(() => {
    try {
      console.log('Deep link handler'); // <---- Never executed
    } catch (e) {
      console.log('');
    }
  });

  appsFlyer.initSdk(
    {
      devKey: APPSFLYER_KEY,
      isDebug: false,
      appId: IOS_APP_ID,
      onDeepLinkListener: true
    },
    () => console.log('Success'), // Success handler
    () => console.log('Failed') // Error handler
  );

  return onDeepLinkCanceller;
};

What did you expect to happen?

Deep link handler to be logged

What happened instead?

Nothing happens

Please provide any other relevant information.

I have Firebase and Facebook SDK installed, so I'm using react-native-permissions to check and request permissions to ATT.


I'd appreciate some help here. I might be missing some configuration. Thanks in advance!

@trinhenouvo
Copy link

trinhenouvo commented May 23, 2021

Our team is facing the same issue with the deferred link on iOS 14.5. The onDeepLink is never triggered in the first launch.

Plugin Version:

"react-native-appsflyer": "6.2.42"

Environment:

  • iOS: 14.5
  • Xcode: 12.5

@amit-kremer93
Copy link
Contributor

@lucasroca @trinhnguyen-enouvo the handler doesn't work at all? or just when the app is in the background/cold start?

@poonai
Copy link

poonai commented Jun 22, 2021

@amit-kremer93 we facing the same issue in android as well.

when the app is in background, onDeepLink works
if the the app is closed and the app is opened via deep link then onDeepLink doesn't get triggered

@kbihani
Copy link

kbihani commented Jun 25, 2021

We are facing the same issue in iOS 14.5 with appsflyer version 6.2.41.
The deep link handler is not triggered at all (app in background or closed state)
Have followed the steps mentioned here: https://github.com/AppsFlyerSDK/appsflyer-react-native-plugin/blob/master/Docs/Guides.md#deeplinking

@amit-kremer93
Copy link
Contributor

@poonai @lucasroca @kbihani try to update to the plugin's latest version. it works with ios 14.5

@ACHP
Copy link

ACHP commented Jul 26, 2021

@amit-kremer93 Are you sure it does works ? Using the provided sample app, it does not ...

  • I did checkout this repo, use the Detox Sample (with some modification as it was not building due to multiple errors (missing libs in package.json)).
  • Update the xcodeproject setting so the app can be opened using our onelinks.
  • on ios 13.7 everything is working fine, on ios 14.5 nothing is working ..

Using

   "react-native": "0.63.4",
   "react-native-appsflyer": "6.3.20",

Tested on simulator (iPhone 11 and iphone 12 max)

@kbihani
Copy link

kbihani commented Sep 23, 2021

@ACHP It worked for us after upgrading to 6.3.50.
We did face an issue where deep links were not working when iOS app was opened from a closed state.

We made a change to the file node_modules/react-native-appsflyer/ios/AppsFlyerAttribution.m b/node_modules/react-native-appsflyer/ios/AppsFlyerAttribution.m:

We needed to add this line twice:
[[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:self.restorationHandler];
[[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:self.restorationHandler];

And it started working.

@michalis-ligopsychakis
Copy link

I have the same problem.. I use react-native-appsflyer@6.4.0 and simulator iOS 14.4 ...
The "onInstallConversionData" called on every launch correctly but the "onDeepLink" not ..
On Android works fine.. @kbihani I tried your solution but didn't worked..

Is there any other solution :) Any help is welcome!

@michalis-ligopsychakis
Copy link

Finally found that "onDeepLink" not get called because I am working with scenes on iOS..

But still, any ideas about how to implement the deep linking methods on AppDelegate.m in order for this to work ..?

@amit-kremer93
Copy link
Contributor

amit-kremer93 commented Nov 17, 2021

@michalis-ligopsychakis if you are using universal-links use this
if you are using uri-scheme, use this:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *) options {
    [[AppsFlyerAttribution shared] handleOpenUrl:url options:options];
    return YES;
}

@GoldenWings
Copy link

GoldenWings commented Jan 24, 2022

@amit-kremer93

@michalis-ligopsychakis if you are using universal-links use this if you are using uri-scheme, use this:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary *) options {
    [[AppsFlyerAttribution shared] handleOpenUrl:url options:options];
    return YES;
}

I am using universal links, and i have the setup you mentioned in AppDelegate.m, The universal link always fall back and neither onDeepLink nor onOpenAppAttribution gets fired, i am testing on simulator btw the fallback happens i suppose because the following snippet
[RCTLinkingManager application:application openURL:url options:options];

@amit-kremer93
Copy link
Contributor

@GoldenWings try to go to node_modules/react-native-appsflyer/ios/AppsFlyerAttribution.m and duplicate this line. it should look like this:

else if(self.userActivity && self.restorationHandler){
        [[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:self.restorationHandler];
        [[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:self.restorationHandler];
        self.userActivity = nil;
        self.restorationHandler = nil;
    }

if it works for you, a fix should be released in the next release

@GoldenWings
Copy link

@GoldenWings try to go to node_modules/react-native-appsflyer/ios/AppsFlyerAttribution.m and duplicate this line. it should look like this:

else if(self.userActivity && self.restorationHandler){
        [[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:self.restorationHandler];
        [[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:self.restorationHandler];
        self.userActivity = nil;
        self.restorationHandler = nil;
    }

if it works for you, a fix should be released in the next release

Actually onDeepLink working without the need of adding those lines will double check tomorrow.
But onAppOpenAttribution it seems not to get fired at all if i used it in place of onDeepLink, just to make sure i am getting it right, onDeepLink is for universal links and onAppOpenAttribution is for URI scheme is that the only difference?

@amit-kremer93
Copy link
Contributor

@GoldenWings onDeepLink and onAppOpenAttribution are both for universal links and uri scheme. the difference is the onDeepLink is newer then onAppOpenAttribution. you can read more here

@artyorsh
Copy link

artyorsh commented Jan 24, 2022

@GoldenWings try to go to node_modules/react-native-appsflyer/ios/AppsFlyerAttribution.m and duplicate this line. it should look like this:

else if(self.userActivity && self.restorationHandler){
        [[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:self.restorationHandler];
        [[AppsFlyerLib shared] continueUserActivity:self.userActivity restorationHandler:self.restorationHandler];
        self.userActivity = nil;
        self.restorationHandler = nil;
    }

if it works for you, a fix should be released in the next release

Actually onDeepLink working without the need of adding those lines will double check tomorrow. But onAppOpenAttribution it seems not to get fired at all if i used it in place of onDeepLink, just to make sure i am getting it right, onDeepLink is for universal links and onAppOpenAttribution is for URI scheme is that the only difference?

Although I don't see any technical explanation of why this should work, I've tried this patch but no luck. iOS 15.2.1, physical device, release build.

@artyorsh
Copy link

artyorsh commented Jan 25, 2022

What's worth mentioning, I was able to make this work by implementing the DeeplinkDelegate to the AppDelegate of our app. In this case RNAppfslyers' (the one is set with initSdk) delegate is ignored before the bridge is initialized, but at least it gives a possibility to handle deep links on cold start by sending handled events back to JS with EventEmitter (this is how it works also in the library), not relying on boxed onDeepLink.

@amit-kremer93 I think the initial problem is that the .deeplinkDelegate is only set when the RNAppsflyers' initSdk is called, and the native deep linking functions sometimes are called much earlier causing apps to lose initial events. Do you think a firebase-like approach could help in solving this problem?

@amit-kremer93
Copy link
Contributor

@artyorsh did you implement deeplinks handling like the docs? if yes, it covers the problem you mentioned where the bridge is initialized later and lose initial events

@artyorsh
Copy link

artyorsh commented Jan 25, 2022

@amit-kremer93 Unfortunately, it doesn't. The AppsFlyerAttribution checks if the bridge is initialized and stores the UserActivity for later use if it doesn't, but the event is still not fired on a cold start.

@GoldenWings
Copy link

@GoldenWings onDeepLink and onAppOpenAttribution are both for universal links and uri scheme. the difference is the onDeepLink is newer then onAppOpenAttribution. you can read more here

Thankfully everything is working just fine now,
except for deferred deep linking the onLinking gets fired twice once with isDeferred false and once with isDeferred true

@msvargas
Copy link

Hi @GoldenWings One question please, does the deferred deep link work for you? I always get isDeferred equals to false and the deepLinkStatus equal to NOT_FOUND, I really appreciate any help, thanks

@natestgermain
Copy link

Hi everyone! Anyone seeing that onDeepLink isn't being called for Android devices when the app is closed and then opened?

We're seeing that onDeepLink doesn't get called on first open after the app being closed. When we try to click the deep link again for the second time (in the same way as the first) while the app is now open, onDeepLink is called and behaves as expected. Thanks!

@yabasha
Copy link

yabasha commented Feb 1, 2023

I am facing the same issue with deep link on iOS 16.3. The onDeepLink is never triggered

Plugin Version:

"react-native": "0.63.5",
"react-native-appsflyer": "^6.9.1"

Environment:

iOS: 16.3

@annasychugina
Copy link

@yabasha Any ideas how to fix it? I contacted with support but there is no solution yet.

I have the same issue but when the app was fully closed. In the foreground it works.

@yabasha
Copy link

yabasha commented Feb 2, 2023

@annasychugina for me it is never triggered for iOS 16 either foreground or background but on Android 12 it works, I don't know what to do as I already started the project using appsflyer!!!

@miladdev85
Copy link

@annasychugina Did you get any response from the support or managed to solve this?
Facing the same issue right now..

@OrenMag
Copy link

OrenMag commented Apr 9, 2023

We are having the same issue. @amit-kremer93
we run
"react-native-appsflyer": "6.10.2"

Deeplinking + deferred deeplinking works well with onelink.me links
But when using an email service (like iterable) - the deeplinking when the app is installed already is resulted with "data": "Authentication Failed",
While deferred deeplinking works

Any idea?

@thaibuiminhncc
Copy link

Has it been resolved yet?

@eramudeep
Copy link

i am also facing same issue, Did anyone able to solve the issue ?

@VadymBezsmertnyi
Copy link

i am also facing same issue

@gustafholmer
Copy link

Same!

@Falco26
Copy link

Falco26 commented May 14, 2024

Any news on this issue?

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

No branches or pull requests