无法在Swift应用中导入Firebase [英] Cannot import Firebase in Swift app
问题描述
您不需要使用桥接Header。
Firebase SDK使用Swift模块映射,所以您必须让CocoaPods知道。
使用这个podfile:
use_frameworks! #this允许您使用导入Firebase
pod'Firebase','> = 2.5.0'
然后你应该可以在任何Swift文件中使用导入Firebase
CocoaPods安装,XCode可能会感到困惑。清理一个 Cmd + K
并重新执行 Cmd + Shift + R
。如果这仍然是给你错误,然后重新启动Xcode,并尝试干净,并再次生成。
In attempting to learn Firebase, I followed the steps in the IOS Quickstart section of the Firebase website. I use Cocoapods and followed the steps exactly as documented. However, "import Firebase" results in a compiler error. I don't see the Framework any where but I do see the Firebase objective C files.. . By following the manual process of downloading the zip file and adding it to the project I can make it work. However, I would like to understand what I am doing wrong.
You shouldn't need to use a Bridging Header.
The Firebase SDK uses Swift module mapping, so you'll have to let CocoaPods know.
Use this podfile:
use_frameworks! # this allows you to use import Firebase
pod 'Firebase', '>= 2.5.0'
Then you should be able to use import Firebase
in any Swift file.
Sometimes after opening from CocoaPods install, XCode can get confused. Do a Cmd+K
to clean and a Cmd+Shift+R
to rebuild. If that still is giving you errors, then restart Xcode and try the clean and build again.
这篇关于无法在Swift应用中导入Firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!