Firebase待处理动态链接无效 [英] Firebase pending dynamic links not working

查看:486
本文介绍了Firebase待处理动态链接无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Firebase动态链接文档,即使未安装应用程序,如果用户打开设备上的链接,Appstore上的应用程序页面也会打开,一旦安装了应用程序,应用程序就会在第一次启动时处理该链接。
经过一番调查后,我发现Firebase有一些名为待定动态链接的东西,并且预计会使用这些链接调用AppDelegate方法:

According to the Firebase Dynamic Links documentation, even if app is not installed, if user opens the link on the device, app page on Appstore opened, and once app installed, application handles the link on the first launch. After some investigation how this handles, I found that Firebase has something called "pending dynamic links", and it is expected, that AppDelegate method is called with these links:

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options

此假设的来源:
https://groups.google.com/forum/#!msg/firebase-talk/2STD8eIi61I/8KJqZN7TBAAJ

但是当我尝试测试这个待定动态lynks功能时,这两个AppDelegate方法都没有被调用

But when I try to test this "pending dynamic lynks" feature, neither of these two AppDelegate methods been called

-(BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options

同时,如果安装了应用程序,动态链接将按预期工作,通过openURL:方法,如果通过Chrome从gmail应用程序打开,通过iOS9及更高版本的通用链接打开,如果从Notes或Mail应用程序打开(实际通过Safari)。

At the same time, if app installed, dynamic links work as expected, opening through the openURL: method if opened from gmail app through Chrome, through Universal links on iOS9 and later if opened from Notes or Mail app (through Safari actually).

所以,我的问题是:挂起的动态链接预期如何运作?我的应用程序无法处理它们的原因是什么?

So, my question is: How the "pending dynamic links" are expecting to work? What could be the reason my app doesn't handle them?

----------------编辑 - --------------

问题是,默认情况下,Firebase尝试使用网址方案打开应用等于应用程序包ID,这不是我的情况。我已将Firebase的配置更改为下一个:

The problem was, that by default Firebase tries to open the app with URL scheme which equals to the app bundle ID, which was not my case. I have changed my configuration of Firebase to the next:

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];
options.deepLinkURLScheme = @"MY-CUSTOM-SCHEME";
[FIRApp configureWithOptions:options];

它开始工作,例如 openURL:方法在第一个应用程序打开时立即调用,如果之前在设备上打开了链接。

And it start working, e.g. openURL: method is called now on the very first app open if link was opened on the device before.

推荐答案

安装后深层链接基于检查标志:

The post-install deeplinking is based on checking a flag:


  • [ FIRApp配置] 调用

  • 动态链接SDK检查它是否是全新安装(例如,没有标志)

  • 如果因此,它调用动态链接API来检查是否存在要解析的动态链接

  • 如果是,则SDK调用 [[UIApplication sharedApplication] openURL:url] ; 使用在 FIROptions 上手动设置的自定义URL方案或小写包ID(例如com.foo.bar)。

  • [FIRApp configure] called
  • Dynamic Links SDK checks whether it is a fresh install (e.g. no flag present)
  • If so, it calls the Dynamic Links API to check if there is a dynamic link to resolve
  • If yes, the SDK calls [[UIApplication sharedApplication] openURL:url]; using the custom URL scheme set up manually on FIROptions or the lowercase bundle ID (e.g. com.foo.bar).

如果您没有收到,请检查自定义URL方案是否已正确定义。

If you're not receiving, check the custom URL scheme is properly defined.

这篇关于Firebase待处理动态链接无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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