簡單地看:咱們在寫項目的時候,大部分宏定義,頭文件導入都在這裏,Xcode6去掉Precompile Prefix Header的主要緣由可能在於Prefix Header大大的增長了Build的時間。沒有了Prefix Header以後就要經過手動@import來手動導入頭文件了,在失去了編程便利性的同時也下降了Build的時間。具體緣由xcode
如何在Xcode6中添加pch(Precompile Prefix Header)?
1,Command+N,打開新建文件窗口:ios->other->PCH file,建立一個pch文件:「工程名-Prefix.pch」:spa
![](http://static.javashuo.com/static/loading.gif)
2,將building setting中的precompile header選項的路徑添加「$(SRCROOT)/項目名稱/pch文件名」(例如:$(SRCROOT)/LotteryFive/LotteryFive-Prefix.pch)code
![](http://static.javashuo.com/static/loading.gif)
能夠了,編譯一下程序,若是有錯誤檢查一下添加的路徑是否正確。blog
3,將Precompile Prefix Header爲YES,預編譯後的pch文件會被緩存起來,能夠提升編譯速度開發
![](http://static.javashuo.com/static/loading.gif)
self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];
self.window.backgroundColor = [UIColor whiteColor];
RootViewController *rootVC = [[RootViewController alloc]initWithNibName:@"RootViewController" bundle:nil];
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:rootVC];
[rootVC release];
self.window.rootViewController = nav;
[self.window makeKeyAndVisible];