gpt4 book ai didi

ios - 通用链接打开我的应用程序,但不调用应用程序 :continueUserActivity:restorationHandler

转载 作者:行者123 更新时间:2023-12-01 15:21:05 24 4
gpt4 key购买 nike

我正在尝试在我的应用程序中实现通用链接。我阅读了很多教程,并遵循了这个教程:
How to support Universal Links in iOS App and setup server for it?

当我单击通用链接时,我的应用程序成功打开,但 application:continueUserActivity:restorationHandler在我的 AppDelegate.m 文件中没有被调用,所以我无法定向到应用程序中的特定页面。

我的 apple-app-site-association文件在 https 上,对于我放置的路径 [ "*", "/" ] .我三重检查了应用程序前缀和 ID,确认在开发者网站和我的目标中都启用了 AssociatedDomains。在 Associated Domains 部分中,我将我的根域以及第二个条目以 *.处理所有可能的子域。我在真实设备上测试,而不是在模拟器上。

-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray * _Nullable))restorationHandler {
ALog(@"Did I get here?");
}

任何人都可以提供有关我应该注意什么以找出原因的建议 application:continueUserActivity:restorationHandler不是被叫了吗?

更新:

我使用了 Apple 的验证工具 https://search.developer.apple.com/appsearch-validation-tool它给出了这个结果:

Link to Application

Action required

Could not extract required information for Universal Links. Learn how to implement the recommended Universal Links.

Error no apps with domain entitlements The entitlement data used to verify deep link dual authentication is from the current released version of your app. This data may take 48 hours to update.



不知道和我的问题有没有关系。我不这么认为,因为我需要测试我的应用程序以确保在实际发布更新之前正确实现了通用链接。

最佳答案

如果应用程序中使用了 Google Analytics 或某些 Firebase 功能,则可能是由于方法 swizzling 造成的。在application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?)中添加以下方法为我解决了这个问题。我认为禁用方法调配也会起作用。

private func swizzleSelectors() {

let aClass: AnyClass! = object_getClass(UIApplication.shared.delegate)
let originalMethod = class_getInstanceMethod(aClass, #selector(self.application(_:continue:restorationHandler:)))
let swizzledMethod = class_getInstanceMethod(aClass, #selector(UIApplication.shared.delegate!.application(_:continue:restorationHandler:)))
if let originalMethod = originalMethod, let swizzledMethod = swizzledMethod {
method_exchangeImplementations(originalMethod, swizzledMethod)
}
}

关于ios - 通用链接打开我的应用程序,但不调用应用程序 :continueUserActivity:restorationHandler,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38839125/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com