记不清楚是从Xcode(大概是Xcode6)多少开始,在新建工程的时候苹果取消了.pch文件。差不多有两年没有在工程中新建pch文件了,今天刚好有需要使用pch文件,但是新建方法忘记了-_-。好记性不如烂笔头,自己还是记一下吧,方便下次使用。(这种文章太多了,我写主要是纯碎自己使用方便)
在工程中 New File..选择PCH File

重新命名或者不用重新命名都可以

选中工程,选择 Build Setting 找到

然后就可在里面写上公用的宏定义了,里面不要写太多东西,会增加app的运行时间!
网友评论