Firebase iOS/Swift和深层链接 [英] Firebase iOS / Swift and Deep Links

查看:454
本文介绍了Firebase iOS/Swift和深层链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们刚刚集成了Firebase,突然之间,我们的深层链接不再起作用.我们使用AppAuth进行身份验证,因此我们依靠深层链接将我们定向到正确的位置.我收到以下错误:

We have just integrated firebase, and all of a sudden our deep links are no longer working. We're using AppAuth for authentication, so we're reliant on deep links to direct us to the right place. I'm getting the following error:

<Debug> [Firebase/Analytics][I-ACS023001] Deep Link does not contain valid required params. URL params: {...}

firebase的初始化如下:

Initialization of firebase as follows:

let bundleId = Bundle.main.bundleIdentifier
let filePath = Bundle.main.path(forResource: "GoogleService-Info-" + bundleId!, ofType: "plist")!
let options = FIROptions(contentsOfFile: filePath)
FIRApp.configure(with: options!)

这是深层链接功能:

    func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
        return application(app, open: url, sourceApplication: nil, annotation: [:])
    }

    func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
        if url.host == AppHost.deeplink {
        ...
   }

如果我删除对FIRApp.configure的调用,则应用程序中的所有内容都可以正常运行.我的AppAuth将流重定向到上面的函数中,没有任何问题.但是,通过调用configure(),它永远不会进入任何一个函数.结果,我无法进行令牌交换并完成身份验证.

If i remove the call to FIRApp.configure, everything in the app works fine. My AppAuth redirects flow into the function above without any issue. However, with the call to configure(), it never gets into either one of the functions. As a result, i can't do a token exchange and complete authentication.

我怀疑AppDelegate代理可能是问题所在,因此我尝试在plist文件中将其禁用.我已经验证传递给FIRApp.configure的plist文件具有适当的密钥:

I suspected the AppDelegate proxy might be the issue, so i tried disabling it in the plist file. I've validated that the plist file passed to FIRApp.configure has the appropriate keys:

<key>FirebaseAppDelegateProxyEnabled</key>
<false/>

但是无论我做什么,它仍在激活代理:

But no matter what i do, it's still activating the proxy:

[Firebase/Analytics][I-ACS003007] Successfully created Firebase Analytics App Delegate Proxy automatically. To disable the proxy, set the flag FirebaseAppDelegateProxyEnabled to NO in the Info.plist

我仅使用FirebaseCrash和FirebaseCore(以及通过崩溃间接使用的FirebaseAnalytics)

I'm using only FirebaseCrash and FirebaseCore (and FirebaseAnalytics indirectly through crash)

推荐答案

不是将FirebaseAppDelegateProxyEnabled键添加到GoogleServices-Info.plist,而是将其添加到应用程序的info.plist中.生成后,不得修改Google Services plist.

Instead of adding the FirebaseAppDelegateProxyEnabled key to the GoogleServices-Info.plist, add it to your App's info.plist. The Google Services plist should not be modified once it's generated.

关于禁用代理,可以长期这样做.代理是一件方便的事情(它只是混淆了一些方法),您可以手动重新实现它. 此处有一些示例,说明了如何处理缺少代理(非欺诈案件).

As for disabling the proxy, it's fine to do this long term. The proxy is a convenience thing (it's just swizzling some methods), and you can reimplement it manually. There's some examples here of how to handle the lack of the proxy (non-swizzling case).

这篇关于Firebase iOS/Swift和深层链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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