首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用AppsFlyer和React Native启动通用链接时未调用continueUserActivity

使用AppsFlyer和React Native启动通用链接时未调用continueUserActivity
EN

Stack Overflow用户
提问于 2021-03-31 02:55:21
回答 1查看 207关注 0票数 0

我正在为React Native应用添加通用/深度链接,它也在使用AppsFlyer React Native插件/ iOS SDK (不过我认为这不是问题所在)。每当我单击通用链接( AppsFlyer OneLink)时,它都会启动应用程序,但不会调用application:continueUserActivity:restorationHandler方法。当我通过配置的URL方案启动时,它工作得很好。我已经添加了一个willContinueUserActivityWithType方法,当使用NSUserActivity类型的NSUserActivityTypeBrowsingWeb启动应用程序时,这个方法就会运行,但在此之后,它就会像往常一样启动应用程序。这是AppDelegate.m中的代码:

代码语言:javascript
运行
复制
#import <RNAppsFlyer.h>

@implementation AppDelegate

// ...

- (BOOL)application:(UIApplication *)application willContinueUserActivityWithType:(nonnull NSString *)userActivityType {
  if ([userActivityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
    return YES; // using the xcode debbugger I can see it gets to here
  }
  return NO;
}

// handle Universal Links
- (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity
 restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler {
  [[AppsFlyerAttribution shared] continueUserActivity:userActivity restorationHandler:restorationHandler]; // I don't think this is an issue. But I can provide more details about AppsFlyer if you need it
  return YES;
}

// other library/framework initialistion

@end

Appsflyer github here有一个问题,但是所有的建议都没有起作用,而且这个问题显然已经在我正在使用的最新框架版本(6.2.41)上得到了修复。在React Native github here上也有一个问题,但我已经尝试了建议(禁用远程JS调试、发布构建等),但什么都不起作用;事实上,在发布模式下,根本不会调用willContinueUserActivityWithType。不过,我会继续在这里做实验。

EN

回答 1

Stack Overflow用户

发布于 2021-09-01 14:30:07

我不确定这是否也会对你有帮助,但我的问题是,Firebase在GLUAppDelegateSwizzler.m中用自己的调用覆盖了continueUserActivity调用。我修复它的方法是将以下代码添加到info.plist文件中:

代码语言:javascript
运行
复制
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66876887

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档