简体   繁体   English

Firebase桥接标头不起作用

[英]Firebase bridging header not working

I'm building a Firebase app in swift, I installed the cocoa pod correctly then created an Objective-C file so it would make me a bridging header. 我正在迅速构建一个Firebase应用程序,我正确安装了可可豆荚,然后创建了一个Objective-C文件,因此它使我成为了桥接头。 When I try to import Firebase elsewhere in the app it says no such module found. 当我尝试将Firebase导入应用程序中的其他位置时,它说未找到此类模块。 I tried to build anyway because sometimes the error will go away but it failed. 我还是尝试构建,因为有时错误会消失但失败了。

Should I do something with my build settings? 我应该对我的构建设置做些什么吗? I've created bridging headers before and never had too (I thought Xcode did that automatically). 我之前创建过桥接头,但是从来没有(我认为Xcode会自动这样做)。 I'm using version 7.2.1 (the latest) by the way. 顺便说一下,我正在使用7.2.1版(最新版本)。

Thanks for the help! 谢谢您的帮助!

#ifndef FirebaseNetwork_Bridging_Header_h
#define FirebaseNetwork_Bridging_Header_h

#import <Firebase/Firebase.h>

#endif

The documentation from firebase says to use import Firebase when in swift. firebase的文档说在快速时使用import Firebase。 This however causes errors at compile time. 但是,这会在编译时导致错误。 After adding the bridging header and importing Firebase.h inside of it, you will be able to access the Firebase api in your swift files. 添加桥接头并在其中导入Firebase.h之后,您将能够在swift文件中访问Firebase api。

Make sure to insert the following line in your Podfile: 确保在Podfile中插入以下行:

use_frameworks!

Then open the .xcworkspace file. 然后打开.xcworkspace文件。 Clean the build. 清理构建。 Compile it. 编译它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM