我正在开发一个基于回合的游戏使用游戏中心。我使用以下代码处理玩游戏的邀请:
GKMatchmaker sharedMatchmaker].inviteHandler = ^(GKInvite* acceptedInvite, NSArray *playersToInvite)
{
if(acceptedInvite != nil)
{
// Get a match for the invite we obtained...
NSLog(@"Valor de la invitacion %@",acceptedInvite);
[[GKMatchmaker sharedMatchmaker] matchForInvite:acceptedInvite completionHandler:^(GKMatch *match, NSError *error)
{
if(match != nil)
{
NSLog(@"match != nil: ");
}
else if(error != nil)
{
NSLog(@"ERROR: From matchForInvite: %@", [error description]);
}
else
{
NSLog(@"ERROR: Unexpected return from matchForInvite...");
}
}];
}
};我希望有一个我收到的所有GKInvite的列表,让他们在一个表视图中,稍后用户将决定接受或拒绝玩游戏的邀请。当然,我使用自己的视图来处理所有的游戏中心选项。
有什么解决方案吗?
发布于 2013-05-07 23:13:49
对于基于回合的游戏,你必须使用GKTurnBasedMatchmaker而不是GKMatchmaker。
此外,我相信您只会看到用户通过滑动邀请接受的游戏的GKTurnBasedMatch对象。
https://stackoverflow.com/questions/16346114
复制相似问题