ios - GKTurnBasedMatch how to accept a new match invitation -


what correct way programmatically accept match invitation gamekit's standard user interface?

i seeing expectedstate="invited" foundstate="active" exception

optional(error domain=gkerrordomain code=22  "the requested operation not completed because specified participant invalid."  userinfo={gkserverstatuscode=5097,  nslocalizeddescription=the requested operation not completed because specified participant invalid.,  nsunderlyingerror=0x14fa2cf70 { error domain=gkservererrordomain code=5097 "status = 5097,  unexpected slot state expectedstate="invited" foundstate="active" 

the exception occurs under following scenario:
player 1 - creates new match player 2
player 1 - makes first move
player 2 - attempts load data turn based match & accept match invitation.

i using ios' standard user interface match making. gkturnbasedmatchmakerviewcontroller

requesting new match

let matchrequest = gkmatchrequest() matchrequest.minplayers = 2 matchrequest.maxplayers = 2 matchrequest.defaultnumberofplayers = 2 matchrequest.invitemessage = "play boxthedots me" matchrequest.recipientresponsehandler = self.matchmaker?.recipientresponse  let matchview = gkturnbasedmatchmakerviewcontroller(matchrequest: matchrequest) self.presentviewcontroller(matchview, animated: true, completion: nil) matchview.turnbasedmatchmakerdelegate = self.matchmaker?.matchviewcontroller 

i accepting match invitation programmatically, causing , printing error.

the code flow starts gkturnbasedmatchmakerviewcontrollerdelegate didfindmatch method

func turnbasedmatchmakerviewcontroller(viewcontroller: gkturnbasedmatchmakerviewcontroller, didfindmatch match: gkturnbasedmatch){     match.loadmatchdatawithcompletionhandler(self.matchdataloaded)         match.acceptinvitewithcompletionhandler(self.acceptinvite) }  private func acceptinvite(match:gkturnbasedmatch?, error:nserror?){     guard error == nil else {         logutil.log(.critical, sub: .error, o: self, method: method, msg: "could not accept match invite. \(error)")         return     } } 

player 1 after making first turn enter image description here

player 2 before loading match player 1 enter image description here

i answered question entirely-programmatically-handled turn-based matches here, , though question on this page using standard gkturnbasedmatchmakerviewcontroller, belive information in post helpful.

what 1 wants, of course, simple delegate function named localplayerdidacceptinvitation(...). absent that, information available @ link might helpful in kludging works.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -