つまり、基本的に、インターフェイス内にプロトコルがあり、不完全なエラーが発生して続行できないため、実装に含める必要があります。
。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
エラーは「プロトコルのメソッドが実装されていません」です。表示できるファイルが他にもありますが、スペースを節約するために、これらのコードだけでこれを修正できるかどうかを確認することにしました。