如何将Firebase添加到Today Extension iOS [英] How to add Firebase to Today Extension iOS

查看:259
本文介绍了如何将Firebase添加到Today Extension iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的今日视图扩展中使用Firebase,但似乎无法导入Firebase模块。我想这是因为我需要一个新的目标在我的可可豆荚文件,但我不知道如何做到这一点。



谢谢。

解决方案

您必须将今天的扩展程序作为自己单独的应用程序(有点)



您的Firebase项目仪表板,您需要点击添加另一个应用程序按钮。



选择iOS,然后输入 TODAY EXTENSION



BUNDLE ID



完成向导并下载生成的 GoogleService-Info.plist 文件



将plist文件添加到 Today Exte转到您的xcode项目,然后将 FirebaseCore.framework和FirebaseDatabase.framework 手动添加到您的今日分机号码。 / p>



FirebaseApp.configure()

 导入FirebaseDatabase 
导入FirebaseCore


覆盖func viewDidLoad(){
super.viewDidLoad()
FirebaseApp.configure()
}


I need to be able to use Firebase in my Today View Extension, however I cannot seem to import the Firebase module. I think it's because I need a new target in my cocoa pods file, but I'm not sure on how to do this.

Thanks.

解决方案

You have to treat the today extension as its own separate app(somewhat)

in your firebase project dashboard, you need to hit the "Add another app" button.

select iOS and then enter the BUNDLE ID of your TODAY EXTENSION

Complete the wizard and download the generated GoogleService-Info.plist file

Add the plist file to your Today Extension's root folder

go to your xcode project, and manually add FirebaseCore.framework and FirebaseDatabase.framework to your Today Extension

finally inside your today today viewcontroller call FirebaseApp.configure()

import FirebaseDatabase 
import FirebaseCore


override func viewDidLoad() {
    super.viewDidLoad()
    FirebaseApp.configure() 
}

这篇关于如何将Firebase添加到Today Extension iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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