Iphone 游戏中心可以';找不到现有的基于回合的匹配项

Iphone 游戏中心可以';找不到现有的基于回合的匹配项,iphone,ios,objective-c,game-center,Iphone,Ios,Objective C,Game Center,我正在写一个基于回合的iPhone游戏,但我似乎找不到自己的游戏。 我有三个帐户试图在我的游戏中配对-一个在我的iPhone 5上,还有两个在iPhone模拟器中创建的不同游戏中心测试帐户,我通过游戏中心沙箱在所有玩游戏的帐户之间切换。不幸的是,他们从未找到彼此,总是自己创造新游戏。我如何修复它,使他们始终能够找到现有的匹配项(如果有可用的匹配项),并且仅在没有打开的游戏时创建新游戏?我假设您正在使用GKTurnBasedMatchmakerViewController查找匹配项,并执行类似的操

我正在写一个基于回合的iPhone游戏,但我似乎找不到自己的游戏。
我有三个帐户试图在我的游戏中配对-一个在我的iPhone 5上,还有两个在iPhone模拟器中创建的不同游戏中心测试帐户,我通过游戏中心沙箱在所有玩游戏的帐户之间切换。不幸的是,他们从未找到彼此,总是自己创造新游戏。我如何修复它,使他们始终能够找到现有的匹配项(如果有可用的匹配项),并且仅在没有打开的游戏时创建新游戏?

我假设您正在使用GKTurnBasedMatchmakerViewController查找匹配项,并执行类似的操作:

GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.minPlayers = 2;
request.maxPlayers = 2;       
GKTurnBasedMatchmakerViewController *mmvc = [[GKTurnBasedMatchmakerViewController alloc] initWithMatchRequest:request];
mmvc.turnBasedMatchmakerDelegate = self;
[self presentViewController:mmvc animated:YES completion:nil];
在代理方法中,您可以这样做,以确定这是一个全新的游戏还是您正在加入一个现有的游戏:

- (void)turnBasedMatchmakerViewController:(GKTurnBasedMatchmakerViewController *)viewController didFindMatch:(GKTurnBasedMatch *)match {

    int numberOfParticipants = [match.participants count];
    // check the number of valid participant ids to find out if you need to know if this is a "new" game or not.
    ....
要使配对将用户与现有游戏配对,对手玩家必须通过在GKTurnedBasedMatch上调用此方法“完成”其回合:

- (void)endTurnWithNextParticipants:(NSArray *)nextParticipants turnTimeout:(NSTimeInterval)timeout matchData:(NSData*)matchData completionHandler:(void(^)(NSError *error))completionHandler;

你测试得有多彻底?可能需要很短的时间,直到选择现有的匹配项来满足您的后续请求。另外,您如何确定某个内容是否是预先存在的匹配?对配对代码和处理程序的一些深入了解可能有助于澄清。