iphone - Can't quit (ending match) in Game Center -


i'm working on turn based ios game using game center , right have test account participating in 6 games in game center, every time try quit 1 swiping on (which should end game because test account 1 in it) removes game table split second , replaces , doesn't quit.

here playerquitformatch function:

// handle players leaving match in , out of turn. - (void)turnbasedmatchmakerviewcontroller:(gkturnbasedmatchmakerviewcontroller *)viewcontroller                       playerquitformatch:(gkturnbasedmatch *)match {     // if player current participant, remove them next participants array.     if ([match.currentparticipant.playerid isequaltostring:gklocalplayer.localplayer.playerid])     {         nsmutablearray* nextparticipants = [nsmutablearray arraywitharray:[match participants]];         [nextparticipants removeobjectidenticalto:[match currentparticipant]];          // if last player, end match because empty.         if ([nextparticipants count] == 0)         {             [match endmatchinturnwithmatchdata:match.matchdata completionhandler:nil];         }         // otherwise, remove them match , pass priority.         else         {             [match participantquitinturnwithoutcome:gkturnbasedmatchoutcomequit                                    nextparticipants:nextparticipants                                         turntimeout:0.0f                                           matchdata:match.matchdata                                   completionhandler:nil];         }     }     // if weren't current participant, remove them match.     else     {         nsmutablearray* nextparticipants = [nsmutablearray arraywitharray:[match participants]];         [nextparticipants removeobjectidenticalto:[match currentparticipant]];          // player can't last person in game if aren't active player.         [match participantquitoutofturnwithoutcome:gkturnbasedmatchoutcomequit withcompletionhandler:nil];     }      nslog(@"playerquitformatch, %@, %@", match, match.currentparticipant); } 

and here's console output:

2013-05-04 13:16:13.180 xyz mobile[7799:c07] authenticating local user... 2013-05-04 13:16:13.587 xyz mobile[7799:c07] authentication changed: player authenticated. may  4 13:16:13 folsom-wireless-153.dynamic2.rpi.edu xyz mobile[7799] <info>: 13:16:13.597120 com.apple.avconference: gksconnsettings: set server: {         "gk-cdx" = "17.173.254.218:4398";         "gk-commnat-cohort" = "17.173.254.220:16386";         "gk-commnat-main0" = "17.173.254.219:16384";         "gk-commnat-main1" = "17.173.254.219:16385";     } 2013-05-04 13:16:21.380 xyz mobile[7799:c07] 101 2013-05-04 13:16:58.150 xyz mobile[7799:c07] new game button pressed 2013-05-04 13:17:00.146 xyz mobile[7799:c07] playerquitformatch, <gkturnbasedmatch 0x949ece0    id:0a8b8246-1872-410e-b9ae-819a9a00d4ff status:open message:(null) taken:(null) created:2013-04-24 23:32:35 +0000 current:<gkturnbasedparticipant 0x949ad50 - id:(null) status:matching outcome:none lastturn:(null)> participants:         <gkturnbasedparticipant 0x949ad40 - id:g:1759434517 (local player) status:done outcome:quit lastturn:(null)>         <gkturnbasedparticipant 0x949ad50 - id:(null) status:matching outcome:none lastturn:(null)>         <gkturnbasedparticipant 0x949f2b0 - id:(null) status:matching outcome:none lastturn:(null)>         <gkturnbasedparticipant 0x949f2c0 - id:(null) status:matching outcome:none lastturn:(null)>         <gkturnbasedparticipant 0x949f650 - id:(null) status:matching outcome:none lastturn:(null)>         <gkturnbasedparticipant 0x949f660 - id:(null) status:matching outcome:none lastturn:(null)>         <gkturnbasedparticipant 0x949bc20 - id:(null) status:matching outcome:none lastturn:(null)>         <gkturnbasedparticipant 0x949bc30 - id:(null) status:matching outcome:none lastturn:(null)>     >, <gkturnbasedparticipant 0x949ad50 - id:(null) status:matching outcome:none lastturn:(null)> 2013-05-04 13:17:08.523 xyz mobile[7799:c07] has cancelled 

do understand correctly that: * game swiped in game center's built-in ui, not custom one? * game in question has player current participant?

i believe have set match outcome unmatched players. if not, still matched. happen gc finds person trying join game , person see game 1 person has quit, himself current participant , 6 unmatched players. code can happen joins game , 7 people have left! yes gc weird.

what want end game set match outcome players , call

endmatchinturnwithmatchdata:completionhandler: 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -