Objective-C Game Center Auto-match "The requested operation could not be completed due to an error c



我正试图通过游戏中心实现自动匹配,我遇到以下错误:"由于与服务器通信错误,请求的操作无法完成。"

我所遵循的教程可以在这里找到:http://www.raywenderlich.com/60980/game-center-tutorial-how-to-make-a-simple-multiplayer-game-with-sprite-kit-part-1

Game Centre认证是在我使用的设备和模拟器上实现的,我正在使用iPhone和iPhone 5S模拟器进行测试。两个设备的沙箱开关都是打开的。

下面是我调用的方法来启动配对过程(调用它为minPlayers = maxPlayers = 2):

- (void)findMatchWithMinPlayers:(int)minPlayers maxPlayers:(int)maxPlayers
                 viewController:(UIViewController *)viewController
                       delegate:(id<GameKitHelperDelegate>)delegate {
    if (!_enableGameCenter) return;
    _matchStarted = NO;
    self.match = nil;
    _delegate = delegate;
    [viewController dismissViewControllerAnimated:NO completion:nil];
    GKMatchRequest *request = [[GKMatchRequest alloc] init];
    request.minPlayers = minPlayers;
    request.maxPlayers = maxPlayers;
    GKMatchmakerViewController *mmvc =
    [[GKMatchmakerViewController alloc] initWithMatchRequest:request];
    mmvc.matchmakerDelegate = self;
    [viewController presentViewController:mmvc animated:YES completion:nil];
}

你知道我哪里做错了吗?提前感谢!

我唯一一次遇到这个问题是当我在设备和模拟器上使用相同的游戏中心帐户时,在设备上使用不同的帐户登录为我解决了这个问题。

相关内容

最新更新