可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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 libraries
everything 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.
What should I try? It took 2 hours and still not working.
Xcode 6. IOS 8
回答1:
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
回答2:
Goto Build Settings > Apple LLVM 6.0 - Language > Prefix Header
Add here: $(SRCROOT)/PrefixHeader.pch
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'
回答3:
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.
回答4:
If you are using cocoapods
, you may checkout this link. I got this problem but none of the solution above worked for me.
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_with
to make life easier.
But life is not always that easy. It looks like that link_with
is deprecated. You may checkout this link.