xcode未知types的名称

我有这样的代码:

Match.h:

#import <Foundation/Foundation.h> #import "player.h" @interface Match : NSObject { Player *firstPlayer; } @property (nonatomic, retain) Player *firstPlayer; @end 

Player.h:

 #import <Foundation/Foundation.h> #import "game.h" @interface Player : NSObject { } - (Player *) init; //- (NSInteger)numberOfPoints; //- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil; @property (nonatomic, retain) NSString *name; @property (nonatomic, retain) NSString *surname; @property (nonatomic, assign) NSInteger *player_id; @property (nonatomic, retain) NSString *notes; @end 

Game.h:

 #import <Foundation/Foundation.h> #import "match.h" #import "player.h" @interface Game : NSObject { NSMutableArray *matches; NSMutableArray *players; NSString *name; } -(Game *) init; @property (nonatomic, retain) NSMutableArray *matches; @property (nonatomic, retain) NSMutableArray *players; @property (nonatomic, retain) NSString *name; @end 

当我声明* firstPlayer时,Xcode不会编译我的项目,并在Match.h中显示错误未知types'Player'。

我试图清理项目,重build它,但没有任何结果…

解决这个循环的正常方法是转发声明类:

在Match.h中:

 @class Player; @interface Match ... Player * firstPlayer; 

并且仅在Match.m中执行#import "Player.hnot在“Match.h”中

其他两个.h文件也是如此。