因此,基本上我的接口中有一個協議,我需要包含在我的實現中,因爲我得到一個不完整的錯誤,因此無法繼續。Cocos2d,需要在我的實現文件中包含協議
。 .h文件
@interface waveLayer1 : CCLayer <GameKitHelperProtocol>
{
...
}
.m文件
@implementation waveLayer1
GameKitHelper.h文件
#import "cocos2d.h"
#import <GameKit/GameKit.h>
@protocol GameKitHelperProtocol
-(void) onLocalPlayerAuthenticationChanged;
-(void) onFriendListReceived: (NSArray*)friends;
-(void) onPlayerInfoReceived:(NSArray*)players;
@end
@interface GameKitHelper : NSObject {
id<GameKitHelperProtocol> delegate; bool isGameCenterAvailable; NSError* lastError;
}
@property (nonatomic, retain) id<GameKitHelperProtocol> delegate;
@property (nonatomic, readonly) bool isGameCenterAvailable; @property (nonatomic, readonly) NSError* lastError;
+(GameKitHelper*) sharedGameKitHelper;
// Player authentication, info
-(void) authenticateLocalPlayer;
-(void) getLocalPlayerFriends;
-(void) getPlayerInfo:(NSArray*)players;
@end
的錯誤是我有更多的文件,我可以顯示 「未實現的協議方法」,但節省空間我決定看看你是否可以幫助我解決這個問題只用這些代碼