0

' GKTurnBasedMatchmakerViewController に問題があります。GKTurnBasedMatchmakerViewController を表示し、[今すぐプレイ] ボタンを押してオートマッチを見つけます。その処理中に、このアプリケーションがクラッシュした後にキャンセル ボタンを押します.. didFindMatch 関数には決して来ません..それより前にクラッシュします。

[今すぐプレイ] を押したときにキャンセル ボタンを無効にすることはできますか?

以下は、GKTurnBasedMatchmakerViewControllerDelegate の私のコードです。

` #pragma GKTurnBasedMatchmakerViewControllerDelegate 関数

// The user has cancelled
- (void)turnBasedMatchmakerViewControllerWasCancelled:(GKTurnBasedMatchmakerViewController *)viewController {
[presentingViewController dismissModalViewControllerAnimated:YES];
if([self.delegate respondsToSelector:@selector(gameCenterViewControllrRemoved)]) {
    [self.delegate gameCenterViewControllrRemoved];
}
self.delegate = nil;
presentingViewController = nil;
}

// Matchmaking has failed with an error
- (void)turnBasedMatchmakerViewController:(GKTurnBasedMatchmakerViewController *)viewController didFailWithError:(NSError *)error {
[presentingViewController dismissModalViewControllerAnimated:YES];
if([self.delegate respondsToSelector:@selector(gameCenterViewControllrRemoved)]) {
    [self.delegate gameCenterViewControllrRemoved];
}
self.delegate = nil;
presentingViewController = nil;
}

// A turned-based match has been found, the game should start
- (void)turnBasedMatchmakerViewController:(GKTurnBasedMatchmakerViewController *)viewController didFindMatch:(GKTurnBasedMatch *)match
{
[presentingViewController dismissModalViewControllerAnimated:YES];
[self setCurrentMatch:match];
GKTurnBasedParticipant *firstParticipant = [match.participants objectAtIndex:0];
if(self.delegate) {
    if (firstParticipant.lastTurnDate == NULL) {
        // It's a new game!
        if ([self.delegate respondsToSelector:@selector(startTurnBasedGame)]) {
            [self.delegate startTurnBasedGame];
        }
        //[self.delegate startTurnBasedGame];
    } else {
        if ([match.currentParticipant.playerID isEqualToString:[GKLocalPlayer localPlayer].playerID]) {
            // It's your turn!
            if ([self.delegate respondsToSelector:@selector(takeTurn)]) {
                [self.delegate takeTurn];
            }
        } else {
            // It's not your turn, just display the game state.
            if ([self.delegate respondsToSelector:@selector(displayLayout)]) {
                [self.delegate displayLayout];
            }
        }
    }
}

} `

ありがとう

チシュティ

4

0 に答える 0