Xcode6后添加ProjectName-Prefix.pch

参考:http://stackoverflow.com/questions/24158648/why-isnt-projectname-prefix-pch-created-automatically-in-xcode-6

Without the question if it is proper or not, you can add PCH file manually:

  • Add new PCH file to the project: New file > Other > PCH file.
  • At the Target's Build Settings option, set the value of Prefix Header to your PCH file name, with the project name as prefix (i.e. for project named TestProject and PCH file named MyPrefixHeaderFile, add the value TestProject/MyPrefixHeaderFile.pch to the plist).
  • TIP: You can use things like $(SRCROOT) or $(PROJECT_DIR) to get to the path of where you put the .pch in the project.
  • At the Target's Build Settings option, set the value of Precompile Prefix Header to YES.



If you decide to add a .pch file manually and you want to use Objective-C just like before xCode 6 you will also have to import UIKit and Foundation frameworks in the .pch file. Otherwise you will have to import these frameworks manually in each header file. You can add the following code anyway as it tests for the language used:

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>
#endif
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,993评论 19 139
  • PLEASE READ THE FOLLOWING APPLE DEVELOPER PROGRAM LICENSE...
    念念不忘的阅读 13,552评论 5 6
  • 睡, 何时, 在何地, 你若愿意, 身体更硬朗…… 顺其自然, 看健康, 歇息, 去。
    小剧在成长阅读 115评论 2 6
  • 婚礼进行曲,我听过很多种。有人独爱浪漫隽永的《我心永恒》,有人选择耳熟能详的《今天你要嫁给我》,有人喜欢非诚勿扰牵...
    赵一初阅读 580评论 0 5
  • 六月的天儿燥热而郁闷,初夏的知了伏在道路两侧的行道树上欢快地叫个不停,考场内外弥漫着一派紧张而森严的氛围。考生们正...
    书茵阅读 184评论 0 0