xcode PrefixHeader.pch 文件找不到标题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25974039/
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 05:39:30  来源:igfitidea点击:

PrefixHeader.pch file can't find headers

iosxcode

提问by sftsz

I have a small prefix header file

我有一个小的前缀头文件

#ifndef UP_FOR_IT_PrefixHeader_pch
#define UP_FOR_IT_PrefixHeader_pch

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
    #import <Parse/Parse.h>
    #import "ABConstants.h"
    #import "ABCache.h"
    #endif
#endif

it can't find Parse.h. I linked it from Link binary with librarieseverything seems right but whatever I tried it does't compile. I tried removing the lib and import again but nothing changed. Removed indexes on derived data but still no clue.

它找不到 Parse.h。我将它从Link binary with libraries一切链接起来似乎是正确的,但无论我尝试过什么,它都无法编译。我尝试删除 lib 并再次导入,但没有任何改变。删除了派生数据的索引,但仍然没有线索。

What should I try? It took 2 hours and still not working.

我应该尝试什么?花了2个小时,仍然没有工作。

Xcode 6. IOS 8

Xcode 6. IOS 8

采纳答案by JonyMateos

Select your project (named "Project" for example) and click on "ProjectTests" (in TARGETS section). Then, go to Build Phases > Link Binary With Libraries and add Parse.framework

选择您的项目(例如名为“Project”)并单击“ProjectTests”(在 TARGETS 部分)。然后,转到 Build Phases > Link Binary With Libraries 并添加 Parse.framework

回答by user8675

Goto Build Settings> Apple LLVM 6.0- Language > Prefix Header

转到构建设置> Apple LLVM 6.0- 语言 >前缀标题

Add here: $(SRCROOT)/PrefixHeader.pch

在此处添加: $(SRCROOT)/PrefixHeader.pch

enter image description here

在此处输入图片说明

If $(SRCROOT) not working for you, set the value of 'Prefix Header' to your PCH file name, with the project name - i.e. for project named 'Test-Project' and PCH file named 'Test-Project-Prefix.pch' and add the complete string 'Test-Project/Test-Project-Prefix.pch'

如果 $(SRCROOT) 不适合您,请将“ Prefix Header”的值设置为您的 PCH 文件名,使用项目名称 - 即对于名为“ Test-Project的项目和名为“ Test-Project-Prefix.pch”的 PCH 文件' 并添加完整的字符串 ' Test-Project/Test-Project-Prefix.pch'

enter image description here

在此处输入图片说明

回答by treatheat

Just in case rest of the answers doesn't work for someone. Try changing Under "Target Membership", the scope of your targets from public to project. Hopefully it helps.

以防万一其他答案对某人不起作用。尝试将“目标成员资格”下的目标范围从公共更改为项目。希望它有帮助。

回答by ManuQiao

If you are using cocoapods, you may checkout this link. I got this problem but none of the solution above worked for me.

如果您正在使用cocoapods,您可以查看此链接。我遇到了这个问题,但上述解决方案都不适合我。

I'm using cocoapods, the reason is that in the Podfile I only linked pods to default target. If you are going to add another one, you should add another target configuration in Podfile(target:'target' do). Usually the new one is the same to the original one, you could use link_withto make life easier.

我正在使用 cocoapods,原因是在 Podfile 中我只将 pods 链接到 default target。如果要添加另一个,则应在 Podfile( target:'target' do) 中添加另一个目标配置。通常新的与原始的相同,您可以使用link_with它使生活更轻松。

But life is not always that easy. It looks like that link_withis deprecated. You may checkout this link.

但生活并不总是那么容易。看起来这link_with已被弃用。您可以查看此链接