xcode 尽管导入了 Firebase.framework,但未找到头文件 (FirebaseCore/FirebaseCore.h)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52077002/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 10:44:52  来源:igfitidea点击:

Header file (FirebaseCore/FirebaseCore.h) not found, despite importing Firebase.framework

objective-cxcodefirebasecocoa-touchfirebase-analytics

提问by Supertecnoboff

I am trying to manually import and use the Firebase framework in my iOS application. I am starting off with the basic bare minimum Analytics framework (then I'll add the rest of the frameworks).

我正在尝试在我的 iOS 应用程序中手动导入和使用 Firebase 框架。我从基本的最低限度的 Analytics 框架开始(然后我将添加其余的框架)。

I followed this tutorialin order to manually import the Google Firebase framework into my Xcode project. The problem is that I am still getting the following error:

我按照本教程将 Google Firebase 框架手动导入到我的 Xcode 项目中。问题是我仍然收到以下错误:

'FirebaseCore/FirebaseCore.h' file not found

找不到“FirebaseCore/FirebaseCore.h”文件

I have imported the frameworks, imported the overall header file and have made sure that the files where actually copied to the project directory folder.

我已经导入了框架,导入了整个头文件,并确保实际复制到项目目录文件夹的文件。

I have set the -ObjC linker flag too.

我也设置了 -ObjC 链接器标志。

enter image description here

在此处输入图片说明

Has anyone else managed to manually import the Google Firebase framework into their Xcode project? What am I missing?

有没有其他人设法将 Google Firebase 框架手动导入到他们的 Xcode 项目中?我错过了什么?

Note: I am not interested in using CocoaPods at all, I just want the simple old fashioned approach.

注意:我对使用 CocoaPods 根本不感兴趣,我只想要简单的老式方法。

采纳答案by Supertecnoboff

There were two problems:

有两个问题:

1) The instructions stated on the Google Developer website for importing the frameworks manually, are somewhat lacklustre. So I followed the following tutorial to import the frameworks and setup my developer account: http://www.mokacoding.com/blog/setting-up-firebase-without-cocoapods/

1) Google Developer 网站上关于手动导入框架的说明有些乏味。所以我按照以下教程导入框架并设置我的开发者帐户:http: //www.mokacoding.com/blog/setting-up-firebase-without-cocoapods/

2) After you have imported all the frameworks/resources/plist files/etc... you will still get the following build error:

2) 在您导入所有框架/资源/plist 文件/等之后...您仍然会收到以下构建错误:

'FirebaseCore/FirebaseCore.h' file not found

找不到“FirebaseCore/FirebaseCore.h”文件

In order to get around this issue, clean your Xcode project and then close the project. Then reopen the project and rebuild it. It will now work - perhaps the Xcode project can now see the framework files or something... not really sure, but it's the only solution that has repeatedly worked for me.

为了解决这个问题,请清理您的 Xcode 项目,然后关闭该项目。然后重新打开项目并重建它。它现在可以工作了 - 也许 Xcode 项目现在可以看到框架文件或其他东西......不太确定,但它是唯一对我反复有效的解决方案。

Update

更新

I think this was just a bug with Xcode 9.x, ever since I upgraded to Xcode 10, I haven't had this issue at all. Just import all the frameworks as usual and build and run the project.

我认为这只是 的一个错误Xcode 9.x,自从我升级到 以来Xcode 10,我根本没有遇到过这个问题。只需像往常一样导入所有框架并构建和运行项目。

回答by gohnjanotis

Make sure you are opening the .xcworkspacefile instead of the .xcodeprojfile.

确保您打开的是.xcworkspace文件而不是.xcodeproj文件。

I was troubleshooting for at least an hour before I determined this was my mistake, so hopefully this answer will save you some time!

在确定这是我的错误之前,我进行了至少一个小时的故障排除,所以希望这个答案可以为您节省一些时间!

回答by MonyneathDEV

Please check on edit scheme -> build -> check if Find implicit Dependencies is enable. if no, enable it and rebuild.enter image description here

请检查编辑方案 -> 构建 -> 检查是否启用了查找隐式依赖项。如果没有,启用它并重建。在此处输入图片说明

回答by Hairsh Kuramsetty

Faced the same problem you can use the below steps which worked for me.

面对同样的问题,您可以使用以下对我有用的步骤。

Step 1: Quit Xcode Delete ~/Library/Developer/Xcode/DerivedData and delete the derived data. Then run.

第一步:退出Xcode 删除~/Library/Developer/Xcode/DerivedData 并删除派生数据。然后跑。

Step 2: If you're getting this error trying to import a dynamic framework, make sure the framework is included in the target's Target Dependencies.

第 2 步:如果您在尝试导入动态框架时遇到此错误,请确保该框架包含在目标的目标依赖项中。

Project > "Target" > Build Phases > Target Dependencies

项目 > “目标” > 构建阶段 > 目标依赖

回答by Gabriel Scalici

Try remove the Podfile.lockfile and Podsfolder.

尝试删除Podfile.lock文件和Pods文件夹。

Run pod install.

运行pod install

This worked for me.

这对我有用。

回答by Naval Hasan

I had the same issue.

我遇到过同样的问题。

It worked for me when I changed

当我改变时它对我有用

#import <FirebaseAuthInterop/FIRAuthInterop.h>

to

#import "FIRAuthInterop.h"