私はGameCenterを使用していますが、Game Centerビューコントローラーを提示して、プレーヤーのオープン(ターンベース)のすべての試合を表示するのは簡単です。ただし、ユーザーが現在関与している試合の数も表示し、GameCenterビューコントローラーを使用せずにそれらの試合を開くためのクイックリンクを提供したいと思います。これを行う方法はありますか?
質問する
558 次
1 に答える
3
次のメソッドを使用して、Game Center から一致のリストを取得できます。
GKTurnBasedMatch loadMatchesWithCompletionHandler
それらをどのようにロードしているかを示すコード スニペットを添付しました。GameKitHelper は、いくつかの一般的なゲーム キット アクションを実行するために使用するシングルトンです。また、プレイヤーのエイリアスをマッチ情報とともに表示するようにリクエストします。
[GKTurnBasedMatch loadMatchesWithCompletionHandler:^(NSArray *matches, NSError *error)
{
if (error)
{
NSLog(@"Load matches error: %@", error.description);
// more error processing here
return;
}
self.currentMatches = matches;
// upate all the matches match data, then end any orphan matches, then get player aliases
// it is very important to update all the match data, because the loadMatchesWithCompletionHandler
// will have no match data, or old match data.
[GameKitHelper updateMatchesMatchData:self.currentMatches completionHandler:^(NSError *error) {
[GameKitHelper endOrphanedMatches:matches completionHandler:^(NSError *error) {
[self requestPlayerAliasesFromGameCenterForMatches:self.currentMatches];
}];
}];
}];
于 2012-12-19T00:14:55.943 に答える