我在使用 iOS 6 SDK 的应用程序中集成游戏中心时遇到问题。事实上,我使用了 Apple 的示例代码,但它看起来不完整:
我试过这段代码:
-(void) authenticateLocalPlayer {
GKLocalPlayer* localPlayer =
[GKLocalPlayer localPlayer];
localPlayer.authenticateHandler =
^(UIViewController *loginVC,
NSError *error) {
[self setLastError:error];
if ([GKLocalPlayer localPlayer].authenticated)
{
// authentication successful
[self enableGameCenterForPlayer:[GKLocalPlayer localPlayer]];
}
else if (loginVC)
{
// player not logged in yet, present the vc
[self pauseGame];
[self presentLoginVC:loginVC];
}
else
{
// authentication failed, provide graceful fallback
[self disableGameCenter];
}
};
}
但问题是 , enableGameCenterForPlayer
, pauseGame
, presentLoginVC
disableGameCenter 不是实现的方法,它返回:
Instance method '-enableGameCenterForPlayer:' not found (return type defaults to 'id')
我该如何解决这个问题?
谢谢