XCode6裏, 新建工程默認是沒有pch文件的,蘋果取消pch文件這一點確定有它的道理,剛開始很是多人可能不適應,假設咱們想使用pch文件,需要手動加入,加入過程例如如下:(依然直接上圖)html
@ 取消的緣由:xcode
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@ 還可以參考:XcodePrecompilePrefixHeader淺析less
@歡迎轉載!轉載請註明:iOS@界迷糊小書童ide