我正在为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调试、发布构建等),但什么都不起作用;事实上,在发布模式下,根本不会调用willContinueUserActivityWithType
。不过,我会继续在这里做实验。
发布于 2021-09-01 14:30:07
我不确定这是否也会对你有帮助,但我的问题是,Firebase在GLUAppDelegateSwizzler.m
中用自己的调用覆盖了continueUserActivity调用。我修复它的方法是将以下代码添加到info.plist文件中:
<key>FirebaseAppDelegateProxyEnabled</key>
<false/>
https://stackoverflow.com/questions/66876887
复制相似问题