3

我在 -prefix.pch 文件中添加了一些东西,但是当我使用它时 XCode 给了我错误,说

使用未定义的标识符...

但是,如果我编译它(Command + B),它会编译,所以我认为它是由派生数据引起的,然后我尝试删除派生数据(从而强制它再次重新生成)但在 Organizer 中没有派生该项目的数据,我也尝试过 Clean 但不起作用。

任何人都可以帮忙吗?

编辑:我定义的宏对这个问题并不重要,但这里是宏:

#define IPAD (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)

编辑 2:我将 Kiwi 作为单元测试工具添加到项目中,可能项目设置中的某些内容发生了更改,从而导致了问题。

4

2 回答 2

1

正如bbum所说

Ewww...不要将宏放在 .pch 文件中!根据定义,.pch 文件是项目特定的预编译头文件。它真的不应该在项目的上下文之外使用,它真的不应该包含任何东西,除了 #includes 和 #imports 1

可能这有帮助

于 2013-08-30T09:49:15.767 回答
0
You will need to include inly framework related headers and also adding header in pch file means you need not import that header in any of the file in your project.
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#endif
于 2013-07-16T04:45:23.233 回答