gpt4 book ai didi

ios - 当应用程序不在后台时无法识别 Firebase 动态链接 (iOS)

转载 作者:行者123 更新时间:2023-11-29 00:05:45 25 4
gpt4 key购买 nike

当应用程序处于后台模式时(已安装并启动一次),单击动态链接会调用 continueUserActivity 方法。

但是,当应用程序尚未启动(或未安装)时,应用程序似乎无法检测到动态链接。 application:openURL:options 永远不会被调用,application:userActivity:restorationHandler 仅在应用程序已启动时被调用。我是否在 applicationDidFinishLaunchWithOptions 中遗漏了某些内容?

预先感谢您提供的每一个帮助!

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

//custom scheme is set to my bundleID as recommended
[FIROptions defaultOptions].deepLinkURLScheme = MY_CUSTOM_SCHEME;
[FIRApp configure]

return YES
}


- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
FIRDynamicLink *dynamicLink = [[FIRDynamicLinks dynamicLinks] dynamicLinkFromCustomSchemeURL:url];


if (dynamicLink) {
if (dynamicLink.url) {
// Handle the deep link. For example, show the deep-linked content,
// apply a promotional offer to the user's account or show customized onboarding view.
// ...
NSLog(@"opened with dynamic link");
} else {
// Dynamic link has empty deep link. This situation will happens if
// Firebase Dynamic Links iOS SDK tried to retrieve pending dynamic link,
// but pending link is not available for this device/App combination.
// At this point you may display default onboarding view.
NSLog(@"not opened with dynamic link");
}
return YES;
}
return NO;
}

- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
restorationHandler:(void (^)(NSArray *))restorationHandler {

NSLog(@"continueUserActivity called");
BOOL handled = [[FIRDynamicLinks dynamicLinks] handleUniversalLink:userActivity.webpageURL
completion:^(FIRDynamicLink * _Nullable dynamicLink,
NSError * _Nullable error) {
NSLog(@"continueUserActivity called");
if (error) {
NSLog(@"dynamic link error: %@", error.localizedDescription);
}
else {
NSLog(@"dynamic link called: %@", dynamicLink.url);
}
}];
return handled;
}

最佳答案

您使用的是哪个版本的 Firebase 动态链接 SDK?确保您更新到最新版本。同时运行方法 [FIRDynamicLinks performDiagnosticsWithCompletion:nil]; 并检查输出是否有任何错误。

您在哪个应用程序中点击动态链接?您是否继续点击 AppPreview 页面中的“打开”按钮?

关于ios - 当应用程序不在后台时无法识别 Firebase 动态链接 (iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48100515/

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