Firebase深度链接Web URL查询为空-iOS [英] Firebase Deep Link Web URL query is empty - iOS

查看:453
本文介绍了Firebase深度链接Web URL查询为空-iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用新的自定义URL接收Firebase动态链接时遇到问题.我创建了一个"abc0.page.link",并设置了所有内容以通过应用程序的代码创建它.

I have a problem receiving Firebase Dynamic Links with the new custom URLs. I created one "abc0.page.link", I set up everything to create it in code from the app.

但是在接收时,我在LOG中收到此消息:

But when receiving, I get this message in LOG:

[Firebase/Analytics] [I-ACS023000]深度链接Web URL查询为空

[Firebase/Analytics][I-ACS023000] Deep Link Web URL query is empty

什么也没有发生,并且处理是错误的.

Nothing happens, and handled is false.

- (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
 restorationHandler:
 #if defined(__IPHONE_12_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_12_0)
(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> *_Nullable))restorationHandler {
#else
    (nonnull void (^)(NSArray *_Nullable))restorationHandler {
#endif  // __IPHONE_12_0
 //(void (^)(NSArray *))restorationHandler {

    NSLog(@"continueUserActivity called, withUser: %@, useractivity: %@, webpageurl: %@", self.user.uid, userActivity, userActivity.webpageURL);
  calledFromURL = YES;
  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);
animated:YES completion:nil];
            }
            else {
}
}];
return handled;
}

这是什么问题?预先谢谢你!

What is the problem here? Thank you in advance!

推荐答案

我在动态链接方面遇到了完全相同的问题. 我在Podfile中使用了以下几行:

I was having the exact same problem regarding Dynamic Links. I was using these lines in my Podfile:

pod 'Firebase/DynamicLinks'
pod 'Firebase/Analytics'

就像订购的官方Firebase教程一样.

Just like the official Firebase tutorial ordered to.

但是,我的应用当时仍使用pod 'Google/Analytics' Pod,该Pod已过时,应切换到Firebase Analytics.

However, my app still used the pod 'Google/Analytics' pod at the time, which has been deprecated and should be switched over to Firebase Analytics.

此Google Analytics(分析)窗格与Firebase的Pod有一个共同的依赖关系(如果我没记错的话,是"Firebase/Core"),但是由于它是一个过时的旧版本,因此其依赖关系必须低于某个特定版本. 因此,即使我没有在Podfile中指定DynamicLinks Pod版本,旧的依赖关系也只能将其升级到特定版本,比最新版本要早.当我尝试按照文档中的建议使用自诊断工具[0]时发现了这一点,而我的代码找不到该工具.

This Google analytics pod has a common dependency with the Pods from Firebase (if I recall correctly, "Firebase/Core") but since it's an old, deprecated version, its dependencies are required to be below a certain version. So, even though I hadn't specified a DynamicLinks pod version in my Podfile, the old dependency only allowed it to be up to a certain version, way older than the up-to-date one. I figured this out when I tried to use the self-diagnostic tool [0] as suggested in the documentation, and my code couldn't find the tool.

所以我使用的解决方法是:

So the workaround I used was:

  • 从我的Podfile中删除Google/Analytics(分析)窗格.当我这样做并执行pod update时,所有与Firebase相关的Pod的版本都与CocoaPods网站[1]上的版本相同,即它们是最新的.

  • Remove the Google/Analytics pod from my Podfile. When I did that, and executed pod update, all Firebase related pods were on the same version as in CocoaPods website [1] i.e. they were up-to-date.

我仍然想使用一段时间的旧Google Analytics(分析),因为我需要动态链接的运行速度比切换到Firebase Analytics所需的速度更快,所以我手动导入了Google Analytics(分析)的静态库(libGoogleAnalytics.a)及其标头.当时一切正常.由于它不再位于Podfile中,因此我不会自动获取更改,但是,我认为不赞成使用的Pod不会成为问题.

I still wanted to use old Google Analytics for a while, since I needed the dynamic links to be working faster than it would take to switch to Firebase Analytics, so I imported manually the static libraries for Google Analytics (libGoogleAnalytics.a) and its headers. It worked just fine then. Since it's not in Podfile anymore, I won't automatically obtain changes, however, I don't think that will be an issue with a deprecated Pod.

如果您的问题确实与此有关,我认为这不是建议的解决方案.您应尽快使用Firebase Analytics,因为移动Google Analytics(分析)将于今年10月关闭.

If your problem was indeed related to this, I don't think this is the suggested solution. You should use Firebase Analytics ASAP since Google Analytics for mobile will be shut down by October this year.

我的猜测是,Firebase函数过去具有解析和转换动态链接的不同方式,这些动态链接与当今控制台创建的链接不兼容,因此它返回一个空的URL查询.

My guess is that the Firebase functions used to have different ways of parsing and translating dynamic links that aren't compatible with the links made by console today, so it returns an empty URL query.

[0]- https://firebase.google.com/docs/dynamic -links/debug

[1]- https://cocoapods.org/

这篇关于Firebase深度链接Web URL查询为空-iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆