http://blog.csdn.net/hmt20130412/article/details/40432495
XCode6里, 新建工程默认是没有pch文件的,苹果取消pch文件这一点肯定有它的道理,刚开始很多人可能不适应,如果我们想使用pch文件,需要手动添加,添加步骤如下:(依旧直接上图)
@ 取消的原因:
Stackoverflow上有一个人对此的解释是这样的:
I suspect because of modules, which remove the need for the #import <Cocoa/Cocoa.h>.
As to where to put code that you would put in a prefix header, there is no code you should put in a prefix header. Put your imports into the files that need them. Put your definitions into their own files. Put your macros...nowhere. Stop writing macros unless there is no other way (such as when you need __FILE__). If you do need macros, put them in a header and include it.
The prefix header was necessary for things that are huge and used by nearly everything in the whole system (like Foundation.h). If you have something that huge and ubiquitous, you should rethink your architecture. Prefix headers make code reuse hard, and introduce subtle build problems if any of the files listed can change. Avoid them until you have a serious build time problem that you can demonstrate is dramatically improved with a prefix header.
In that case you can create one and pass it into clang, but it's incredibly rare that it's a good idea.
翻译过来 大致就是说 也许是因为组件单一模块的原因,所以 放弃了对<Cocoa/Cocoa.h>
的import
你不应该在你的prefix代码中放入任何的代码,把他们放在你确实需要放入的文件中。把你的定义放到属于他们的文件中。 尽量不要使用宏定义(define)。。除非是非不得已的时候,(这里 插一句 不使用宏定义的原因是 宏定义是在预编译的时候处理的 因此 当你修改宏定义的时候 会导致大量的代码被重新编译 另外 宏定义存在许多潜在的bug 是因为在预编译的时候,他并不会被发觉到的)。如果你确实 在被逼无奈需要使用宏定义,把他们放在需要被include的头文件中,而不是放在prefix文件中。
prefix header文件是被那些大量使用 以及 几乎所有系统中的文件都需要被使用(例如 Foundation.h)。如果 你有一些东西大量存在,你应该重新思考你的架构问题你。因为 当你修改你prefix header的一些代码的时候,prefix header导致整个项目重新编译,这让你的代码重用变得困难,并且导致一些琐碎build的问题。所以 不要去使用prefix header 这样可以避免你大量的重新编译整个项目的时间
如果你仍然想要使用预编译,你可以创建一个新的并且传递给编译器的前段,这种方法很少见(我没用过),但确实是一个不错的方法
@ 还可以参考:XcodePrecompilePrefixHeader浅析
@欢迎转载!转载请注明:iOS@界迷糊小书童
相关推荐
Xcode13的XCTAutomationSupport.framework文件
Xcode14的XCTAutomationSupport.framework文件
从Xcode11开始,Application Loader不再集成在Xcode中,需要使用xcodebuild或者xcrun altool命令上传应用。 如果是觉得使用命令行的方式麻烦,下载解压后,复制...../Applications/Xcode.app/Contents/Applications/
Mac软件开发 Xcode 帮助 中文版.pdfMac软件开发 Xcode 帮助 中文版.pdfMac软件开发 Xcode 帮助 中文版.pdfMac软件开发 Xcode 帮助 中文版.pdfMac软件开发 Xcode 帮助 中文版.pdf
Xcode8.2.1百度网盘 链接:https://pan.baidu.com/s/1vJz83ZS5dyx-qXTBMXsk-A 提取码: 复制这段内容后打开百度网盘手机App,操作更方便哦
xcode_6_GM.dmg
Xcode 真机调试 14.6.zip
xcode 真机包15.0.zip
将解压缩后的文件放到以下文件夹(适当修改文件名): 在访达中使用快捷键:低版本xcode兼容iOS15.0.zip、iOS9.0。镜像
opengl超级宝典第五版 中mac下开发OpenGL,在书中描述的在xcode中需要libGLTool.a文件,由于源代码中没有包含libGLTool.a,只有源码,网上通过其他途径(例如:...希望这个工程对在xcode中学习OpenGL有所帮助。
xcode7_mexopts.zip
Title: Xcode 6 Start to Finish: iOS and OS X Development, 2nd Edition Author: Fritz Anderson Length: 656 pages Edition: 2 Language: English Publisher: Addison-Wesley Professional Publication Date: ...
Mac软件开发Xcode帮助中文版.pdf
为了低版本的Xcode可以run高版本的设备,需要高版本的设备支持文件 下载后拷贝到 文件路径:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport 即可
Xcode3高级编程.rar
兼容 Xcode 的编译工具.zip,Xcode-compatible build tool.
xcode_6.0.1.dmg .rar
Mac软件开发Xcode帮助中文版.docx