簡體   English   中英

無法使用GKMatchmakerViewController查找播放器

[英]Not able to find players with GKMatchmakerViewController

我正在嘗試整合Game Center以匹配玩家。 我正在使用該非常簡單的功能:

 
- (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];
}

我有一些回調,從不叫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");
}

當我同時使用iOS 7.1在我的設備(無論是iPhone還是iPad)上進行測試時,我可以從我的應用程序中打開Game Center,但是當我單擊“立即播放”時,我立即收到錯誤消息:“無法找到玩家”。 但是我的回調似乎都沒有在我的代碼中觸發。 任何我做錯事的想法嗎? 我確實嘗試過重置iPad設置,從iCloud注銷,重新啟動設備等。

固定。

除了創建預配置文件並在其中啟用Game Center之外,您還需要在iTunes Connect上添加您的應用。 您需要執行一個非常奇怪的過程,在該過程中要求您提供應用程序的發布日期,價格,一些屏幕截圖和圖標,但是一旦完成,您將能夠啟用Game Center。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM