Ios 在基于回合的比赛中结束回合。
我在基于回合的游戏应用程序中结束回合时遇到问题 我使用的方法是Ios 在基于回合的比赛中结束回合。,ios,game-center,gkturnbasedmatch,Ios,Game Center,Gkturnbasedmatch,我在基于回合的游戏应用程序中结束回合时遇到问题 我使用的方法是 GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch]; [currentMatch endTurnWithNextParticipants:p turnTimeout:1000 matchData:data completionHandler:^(NSError *error) { if
GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch];
[currentMatch endTurnWithNextParticipants:p turnTimeout:1000 matchData:data completionHandler:^(NSError *error) {
if (error) {
NSLog(@"%@", error);
}
}];
这是我对下一个参与者的保证,这是我的声明:
这是我们的声明和任务
NSArray *p = [[currentMatch.participants reverseObjectEnumerator] allObjects];
我正在反转参与者数组以获得玩家的回合顺序。只有两个
这一切都编译和运行没有错误,但回合从来没有真正传递给其他玩家
我认为我的p数组是个问题,我试着在不反转的情况下传递它,结果是一样的
有人知道正确的处理方法吗?用
GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch];
GKTurnBasedParticipant *nextPerson = [currentMatch.participants objectAtIndex:((currentIndex + 1) % [currentMatch.participants count])];
[currentMatch endTurnWithNextParticipants:[NSArray arrayWithObject:nextPerson] turnTimeout:1000 matchData:matchData completionHandler:^(NSError *error) {
if (error) {
NSLog(@"%@", error);
}
}];
将代码替换为
GKTurnBasedMatch *currentMatch = [[GCTurnBasedMatchHelper sharedInstance] currentMatch];
GKTurnBasedParticipant *nextPerson = [currentMatch.participants objectAtIndex:((currentIndex + 1) % [currentMatch.participants count])];
[currentMatch endTurnWithNextParticipants:[NSArray arrayWithObject:nextPerson] turnTimeout:1000 matchData:matchData completionHandler:^(NSError *error) {
if (error) {
NSLog(@"%@", error);
}
}];