简体   繁体   English

无法使用GKMatchmakerViewController查找播放器

[英]Not able to find players with GKMatchmakerViewController

I am trying to integrate Game Center for matching players. 我正在尝试整合Game Center以匹配玩家。 I am using that very simple function: 我正在使用该非常简单的功能:

 
- (void)findOpponent {
    GKMatchRequest* request = [[GKMatchRequest alloc] init];
    request.minPlayers = 2;
    request.maxPlayers = 2;
    GKMatchmakerViewController *mmvc = [[GKMatchmakerViewController alloc]
                                         initWithMatchRequest:request];
    mmvc.matchmakerDelegate = self;

    [[self viewController] presentViewController:mmvc animated:YES completion:nil];
}

I do have some callback, never called tho': 我有一些回调,从不叫tho':


- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindMatch:(GKMatch *)theMatch {
    NSLog(@"he");
    [[self viewController] dismissViewControllerAnimated:NO completion:nil];
    GKMatch* match = theMatch;
    [match setDelegate:self];
    NSLog(@"Ready to start match!");
}

- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didFindPlayers:(NSArray *)playerIDs {
    NSLog(@"Super he");
}

- (void)matchmakerViewController:(GKMatchmakerViewController *)viewController didReceiveAcceptFromHostedPlayer:(NSString *)playerID {
    NSLog(@"Wow");
}

When I test onmy device (wether iPhone or iPad), both using iOS 7.1, I can open Game Center from my Application, but as soon as I click on "Play Now" I instantaneously get the error: "Failed to find players". 当我同时使用iOS 7.1在我的设备(无论是iPhone还是iPad)上进行测试时,我可以从我的应用程序中打开Game Center,但是当我单击“立即播放”时,我立即收到错误消息:“无法找到玩家”。 Yet none of my callback seems to get triggered in my code. 但是我的回调似乎都没有在我的代码中触发。 Any idea of what I am doing wrong? 任何我做错事的想法吗? I did try to reset my iPad settings, logging off from iCloud, rebooting my device, etc. 我确实尝试过重置iPad设置,从iCloud注销,重新启动设备等。

Fixed. 固定。

More than creating a Provisioning Profile and enabling Game Center inside, you also need to Add your app on iTunes Connect. 除了创建预配置文件并在其中启用Game Center之外,您还需要在iTunes Connect上添加您的应用。 You need to go to an extremely strange process where it ask for the release date of your app, the price, some screen shots and icons, but once done you will be able to enable Game Center for real. 您需要执行一个非常奇怪的过程,在该过程中要求您提供应用程序的发布日期,价格,一些屏幕截图和图标,但是一旦完成,您将能够启用Game Center。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM