我的项目编译并运行正常,除非我尝试编译我的单元测试包,它在下面用第5行上的“预期说明符 - 资格列表 - 'CGPoint'”错误进行轰炸:
#import <Foundation/Foundation.h>
#import "Force.h"
@interface WorldObject : NSObject {
CGPoint coordinates;
float altitude;
NSMutableDictionary *forces;
}
@property (nonatomic) CGPoint coordinates;
@property (nonatomic) float altitude;
@property (nonatomic,retain) NSMutableDictionary *forces;
- (void)setObject:(id)anObject inForcesForKey:(id)aKey;
- (void)removeObjectFromForcesForKey:(id)aKey;
- (id)objectFromForcesForKey:(id)aKey;
- (void)applyForces;
@end
我已确保我的单元测试包是我的 WorldObject.m 的目标,并且它的标头已导入我的测试标题中:
#define USE_APPLICATION_UNIT_TEST 1
#import <SenTestingKit/SenTestingKit.h>
#import <UIKit/UIKit.h>
#import "Force.h"
#import "WorldObject.h"
@interface LogicTests : SenTestCase {
Force *myForce;
WorldObject *myWorldObject;
}
@end
答案 0 :(得分:9)
您需要在头文件(问题中的顶级文件)中导入<UIKit/UIKit.h>
而不是<Foundation/Foundation.h>
。