Closed vlceklukas closed 3 years ago
hey @vlceklukas,
Please follow this guide
since 6.2.30 you should replace [AppsFlyerLib shared]
with [AppsFlyerAttribution shared]
hey @pazlavi just tested the updated code, however the result is still the same. When the app is opened it works like a charm. If I kill the app and reopen with the same link, it still does nothing apart from opening the app.
Thank you very much for any help!
adding how onAppOpenAttribution is handled in the code. It is executed when platform is ready.
window.plugins.appsFlyer.registerOnAppOpenAttribution((res) => {
let deeplinkData = JSON.parse(res);
if (deeplinkData.type === 'onAppOpenAttribution') {
let deepLinkValue = deeplinkData.data.deep_link_value;
if (deepLinkValue === 'dl_start_trial') {
this.shakeButton();
}
} else {
console.log('af deeplink :: onAppOpenAttribution error');
}
},
function onAppOpenAttributionError(err) {
console.log('af deeplink :: error :: ', err);
}
);
window.plugins.appsFlyer.initSdk({
devKey: '***', // your AppsFlyer devKey
isDebug: false,
appId: '***', // your ios appID,
onInstallConversionDataListener: true
},
(result) => {
console.log(result);
},
(error) => {
console.error(error);
}
);
EDIT: upon further debugging I can confirm I see AppsFlyer Debug: handle deep link in the syslog of my test device. However no-other log message appears.
I've tested using the onAppOpenAttributionListener and onDeepLinkListener with the root handleOpenUrl function.
var handleOpenURL = function(url) {
console.log('AppsFlyer handleOpenUrl :: ', url);
window.plugins.appsFlyer.handleOpenUrl(url);
}
EDIT 2: Confirming this behavior on iOS 13.5, 14.4 and 14.5 beta.
Hi @vlceklukas do you use cordova with ionic or just cordova? please try to remove this from your code
var handleOpenURL = function(url) {
console.log('AppsFlyer handleOpenUrl :: ', url);
window.plugins.appsFlyer.handleOpenUrl(url);
}
it will be more helpful if you will contact our support support@appsflyer.com
Hi @amit-kremer93 thank you for your comments.
After some more testing I found out that continueUserActivity is not called for some reason when the app is opened through universal link.
What did the trick for me was handling it in didFinishLaunchingWithOptions as follows. Now it triggers everything correctly when the app is opened or previously terminated.
- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
{
self.viewController = [[MainViewController alloc] init];
NSDictionary *activityDictionary = launchOptions[UIApplicationLaunchOptionsUserActivityDictionaryKey];
if (activityDictionary) {
NSUserActivity *activity = [activityDictionary objectForKey:@"UIApplicationLaunchOptionsUserActivityKey"];
NSURL *url = activity.webpageURL;
[[AppsFlyerAttribution shared] handleOpenUrl:url options:launchOptions];
}
return [super application:application didFinishLaunchingWithOptions:launchOptions];
}
I will keep digging into it and try to find the root-cause.
Report
Plugin Version
6.2.30
On what Platform are you having the issue?
iOS
What did you do?
Upon upgrade to the latest version, we are not able to log Universal Link action when app is in background or killed. We are able to detect the URL when we place such code to the AppDelegate didFinishLaunchingWithOptions. We are using a OneLink template. Everything works perfectly when the app is opened.
However it does not seem the continueUserActivity or openURL is called.
What did you expect to happen?
Universal link action should have been logged and triggered.
What happened instead?
App opens on the main screen with no action triggered.
Copy of our AppDelegate.m file