-
Notifications
You must be signed in to change notification settings - Fork 199
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] Deep link handlers not called when app is fully closed #223
Comments
Also problem, please fix this bag |
Same problem here Plugin 6.1.20 Appears only on iOS, on Android works as expected. |
Hi @amit-kremer93, do you have any updates on this? |
Did you follow this?? |
|
6.0.50 - does not handled when the app is turned on :( can developers combine these 2 functions? or maybe add in |
@Goldyukol in which type of deep link do you use? URL scheme or universal link? |
@amit-kremer93 how does it work for you ? we use appsflyer links |
In latest version this features doesn't work |
Yes, I've followed those steps. The issue still remains. As mentioned by @rborn, using
I'm using universal links. |
@amit-kremer93 like the rest of us here, definitely still happening on my end. On relaunching the app, |
It seems like the issue started after the native SDK was upgraded and we are working on a solution. |
I released a new version (6.1.40) with a fix for the onAppOpenAttribution in iOS. The implementation has slightly changed so please see this but the flow is the same. Please let us know here if there is any problem. thanks! |
UpdateThose who are running into this might find #223 (comment) useful.
@amit-kremer93 Yup, unfortunately, there is one. I opened the app from the phone's email client. Then shortly after, the app crashed before it could even start logging anything to the JavaScript console. Here's the native log. default 12:17:28.772654+0800 ML.Debug [DEBUG] AppsFlyer: [HTTP]
Result: {
data = {length = 4, bytes = 0x226f6b22};
dataStr = "\"ok\"";
retries = 2;
statusCode = 200;
taskIdentifier = 3;
}
Error: (null)
default 12:17:28.772732+0800 ML.Debug [DEBUG] AppsFlyer: Loading conversion data
default 12:17:28.773572+0800 ML.Debug [DEBUG] AppsFlyer: [GCD-A02] -[RNAppsFlyer onConversionDataSuccess:]:
{
"af_message" = "organic install";
"af_status" = Organic;
"install_time" = "2021-01-18 04:06:20.689";
"is_first_launch" = 0;
}
default 12:17:28.775784+0800 ML.Debug [DEBUG] AppsFlyer: [CACHE] Deleting file: /var/mobile/Containers/Data/Application/1E631D5D-803D-4A15-8B56-FA65694DFF2D/Library/Caches/appsflyer-v1/632636244.2472.plist
default 12:17:28.775850+0800 ML.Debug [DEBUG] AppsFlyer: [HTTP] Dealloc. Time elapsed for: `160-1610943444.211549` - 3.944231986999512
default 12:18:09.942508+0800 ML.Debug *** Assertion failure in -[RCTEventEmitter sendEventWithName:body:](), /Users/csantarin/moneylion/mobile-app/node_modules/react-native/React/Modules/RCTEventEmitter.m:50
default 12:18:10.253181+0800 ML.Debug *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Error when sending event: onAttributionFailure with body: {"status":"failure","type":"onAttributionFailure","data":"Authentication Failed"}. Bridge is not set. This is probably because you've explicitly synthesized the bridge in RNAppsFlyer, even though it's inherited from RCTEventEmitter.'
*** First throw call stack:
(0x1853619d8 0x1996cab54 0x18527050c 0x1865b9238 0x1051ecf80 0x1058948a8 0x1058946c8 0x186657614 0x1852e1bf0 0x1852e1af0 0x1852e0e38 0x1852db3e0 0x1852daba0 0x19c018598 0x187bca3d8 0x187bcf958 0x104604564 0x184fb9568) |
@csantarin |
@amit-kremer93 , I'm testing version
I already updated |
How you updated Send code pls |
You can find it in the updated guide: https://github.com/AppsFlyerSDK/appsflyer-react-native-plugin/blob/master/Docs/Guides.md#import
|
added after?
|
Problem is not resolved |
UpdateThose who are running into this might find #223 (comment) useful. @Goldyukol not-maintainer here. On #import <RNAppsFlyer.h>
#import <React/RCTLinkingManager.h>
#import <AppsFlyerLib/AppsFlyerLib.h>
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Flipper init here...
if(_AppsFlyerdelegate == nil){
_AppsFlyerdelegate = [[RNAppsFlyer alloc] init];
}
[[AppsFlyerLib shared] setDelegate:_AppsFlyerdelegate];
// React Native Bridge and Root View init here...
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc]
initWithBridge:bridge
moduleName:@"FiftyViewsUnderTheAppiumSea"
initialProperties:nil
];
// More on React Native Bridge and Root View init here...
return YES;
} Correct me if I'm wrong, @amit-kremer93. That's how I'm initializing the SDK on my end. |
Right you are, @amit-kremer93. But I've followed the iOS SDK / RN plugin integration guide. The On my end, |
@amit-kremer93 we are also experiencing a similar issue. On the latest version of the plugin (
Everything is setup according to the docs and was not crashing before updating the plugin (although onDeepLink was not firing on iOS). I have made the recommended changes from the new readme to the If the app is in the background, it works as expected i.e. the |
Same here, if i open the app and then i use deep link it works, but when the app is completely closed does not work :( |
Having similar issue with Any solution here? |
I'm having the same problem, still haven't found the solution? |
Use latest version, clean your project and try again |
Issue happens to me when trying to click on deep link from a closed app. edit: this happens when I try to use: either way does not seem to work for me (updated to latest version but to no avail |
@amit-kremer93
|
So yes actually it appeared that this does not work in debug mode but only in release |
@OrLevy23 Appsflyer doesn't work on debug mode, only for published apps. would you mind sharing your |
Ok, it seems that this line was causing the issue in
rewriting the above to the following seem to have fixed the problem for me
|
So we have just noticed that this issue reconstructs for us. not sure whether this is a ios version specific issue (happens from ios 16 and above. currently struggling to test on older versions) or build issue. |
Any ideas how to fix it ? I reproduced it on IOS v16 with UDL. After clicking on the link the application opens but the internal deeplink on current screen in the app does not work. It happened when app is fully closed I've already tried this solution
But it didn't help. The same behavior. Nothing changed. I use the latest version of
|
@annasychugina is this something that used to work and stopped for you on iOS 16? |
@OrLevy23 no, I didn't check it before. We started implementing UDL links (onelink) and I use onDeepLink method in the latest version of react-native-appsflyer. I didn't check previous versions . So, it doesn't work with cold boot (app opens but there is no redirect to current screen, onDeepLink isn't triggered) In the background everything works correctly. Any solutions ? I tried everything which was mentioned here. So, think about not using onDeepLink method and start using Linking API (https://reactnative.dev/docs/linking) But if you have any ideas and hacks how to fix (maybe it worked in previous version ?? because it's very strange, it's critical bug and yet there is no solution ). It doesn't work in IOS 14.0 and IOS >= 16.0 versions (I didn't check previous) |
I also sent email to support.appsflyer.com but no answer |
Hi guys, are there any updates on this issue? |
I am working on a former hybrid RN app that still had aspects of the code in Swift. Recently, while migrating Segment code, I broke AppsFlyer deeplinking and I was faced with the cold boot issue describe above. We had been using the Segment pod to import the dependency and now it's coming from the node_modules folder. The issue is a race condition between the iOS did launch handler and the RN bridge being loaded. When the SDK was fully native it didn't care about a bridge! So calling the following would lead to the deeplink handler being called:
The first fix was to change it to:
This was ultimately the change the fixed it for me. However because we have more than one deeplinking solution in our app, I need it to return a boolean so that I know it's a valid AppsFlyer link. If you look at their code, it checks if the bride is loaded.
So if you are like me and need conditions around returning true, the following solution will work:
What happens is the "AppsFlyerLib.shared().continue" function returns a boolean saying that the link applies to AppsFlyer. But because the bridge is not ready it does not get handled. Knowing the bridge is not ready using their boolean, calling "AppsFlyerAttribution.shared().continue" invokes "[self setUserActivity:userActivity]" which solves the race condition. When the bridge is ready, the AppsFlyerLib works fine. If the function "setUserActivity" was exposed you could just call that directly, but knowing how it's currently implemented you can assume how it will behave when the bridge is not ready. We have our own boolean that tells us if the bridge is ready, but I chose to use the same one they do so I know 100% it will hit the "setUserActivity" function and not handle the deeplink twice or something. Honestly I find it very confusing there is both AppsFlyerLib and AppsFlyerAttribution. Also very annoying that the AppsFlyerAttribution version does not provide a boolean. In psudo code it's like this
Hope this helps someone, this was very frustrating for me. Having two very similar instances of classes that have these subtle differences is very confusing. |
@paul-hart I'm facing a similar issue where in React Native my appsFlyer.onDeepLink function is only being called for deeplinks via URI scheme but not universal links. My AppDelegate.swift has this function implemented func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Swift.Bool {
var result = authorizationFlowManagerDelegate?.resumeExternalUserAgentFlow(with: url) ?? false
if (!result) {
AppsFlyerLib.shared().handleOpen(url, options: options)
result = RCTLinkingManager.application(app, open: url, options: options)
if (result) {
UAMessageCenter.shared()?.defaultUI.dismissMessageCenter(animated: true);
}
}
return result;
} I tried to add your suggestion to this function func application( _ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void ) -> Bool {
return RCTLinkingManager.application( application, continue: userActivity, restorationHandler: restorationHandler)
} But I have the error |
Just noticed this message sorry. It was from: |
Oddly enough I had to work on this part of the code almost exactly one year later. Established the following:
|
Any news on this? I'm facing the same problem. The deeplink doesn't work when the ios app is fully closed. |
@annasychugina did you find a solution for this? |
guys, try add this:
|
Where did you add this? |
insert this into your SceneDelegate. Info about clicked deeplink pass into the app through connectionOptions param. Previously this info passed into AppDelegate didFinishLaunching... method. |
This is caused by iOS functions ( Switching to To get around this I added AppDelegate
|
@cvlehe could you please share your full implementation please? |
Hey guys, I've got the same issue. But solution from above to use |
It's basically just as a I said previously. After you install the AppsFlyer plugin, open your project file in Xcode, add |
if someone still have problem with Objective-C, follow this. (*i got some hint from @cvlehe, and use translate Objective-C from Swift. ) previous
after
|
I wish AppsFlyer team would implement these fixes themselves, I think they do not really maintain this SDK |
This doesn't work for me. The onDeepLink callback is not called even with this modification. |
Plugin Version
6.1.20
On what Platform are you having the issue?
iOS
What did you do?
Installed the latest version of the plugin
What did you expect to happen?
onDeepLink to be called
What happened instead?
The handler wasn't triggered
Please provide any other relevant information.
On iOS, react-native-appsflyer version 6.1.10, when clicking a OneLink the app opens but
onAppOpenAttribution
is not triggered when the app is fully closed.Then I upgraded to react-native-appsflyer version 6.1.20 to test unified links. Again,
onDeepLink
works on every case except when the app is installed but fully closed and I open a OneLink.I tried both on simulator and real device with no luck.
The text was updated successfully, but these errors were encountered: