3

据我了解,.pch 文件负责预编译头文件。听起来像是可以重建或重建的东西。

2个问题:

  1. Xcode 是否有类似于回收站的东西从那里删除文件可以撤消?
  2. 有没有直接重建 .pch 文件的方法?
4

3 回答 3

7

对于 CocoaTouch (iPhone),它是:

//
// Prefix header for all source files of the 'Test' target in the 'Test' project
//

#import <Availability.h>

#ifndef __IPHONE_3_0
#warning "This project uses features only available in iPhone SDK 3.0 and later."
#endif

#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
于 2011-08-30T02:27:48.553 回答
4

.pch 文件通常非常简单,其内容取决于项目类型。基本思想是它包含重量级的头文件。Xcode 本身不会在基本模板之外修改这个文件;如果您自己更改它,它只会与模板不同。

对于 Cocoa 应用程序,它是:

//
// Prefix header for all source files of the '%s' target in the '%s' project
//

#ifdef __OBJC__
    #import <Cocoa/Cocoa.h>
#endif

就是这样!您可以在 SDK 文件夹中找到所有模板。

IOS:/Developer/Platforms/iPhoneOS.platform/Developer/Library/Xcode/Project Templates/

于 2011-07-04T03:41:43.070 回答
1

如果您删除了 pch 头文件,则将其从 scm 中拉出。如果你不使用 scm - 使用 scm(例如 git)。

如果您只是指预编译结果 - xcode 只是根据需要重建它。它永远不需要手动重建。如果你真的需要手动重建它,你可以在你的 Derived Data 目录中找到它(假设是 Xc4),或者只是清理项目并在清理过程中删除预编译的头文件。它们将在下一次构建时自动重新创建。

于 2011-07-04T03:41:23.103 回答