微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 AppsFlyer 和 React Native 启动 Universal Link 时不会调用 continueUserActivity

如何解决使用 AppsFlyer 和 React Native 启动 Universal Link 时不会调用 continueUserActivity

我正在将通用/深度链接添加到 React Native 应用程序,并且它也在使用 AppsFlyer React Native 插件/iOS SDK(不过我认为这不是问题)。每当我单击通用链接(AppsFlyer OneLink)时,它都会启动应用程序,但根本不会调用 application:continueUserActivity:restorationHandler 方法。当我通过配置的 URL 方案启动时,它工作正常。我添加一个 willContinueUserActivityWithType 方法,当应用程序以 NSUserActivity 类型的 NSUserActivityTypebrowsingWeb 启动时运行,但之后它只是正常启动应用程序。这是 AppDelegate.m 中的代码


#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 调试、发布构建等),但没有任何效果;事实上,在 Release 模式下,willContinueUserActivityWithType 根本不会被调用。不过我会继续在这里进行实验。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。