0

我正在为 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 上也有一个问题,但是我尝试了这些建议(禁用远程 JS 调试、发布构建等),但没有任何效果;实际上在发布模式下,willContinueUserActivityWithType根本不会被调用。不过,我继续在这里进行实验。

4

1 回答 1

0

不确定这是否对您也有帮助,但我的问题是 Firebase 在GLUAppDelegateSwizzler.m. 我修复它的方法是将其添加到 info.plist 文件中:

<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
于 2021-09-01T14:30:07.463 回答