Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble with GKTurnBasedMatch endTurnWithNextParticipants:turnTimeout:matchData:completionHandler:

I am making an iphone game using GKTurnBasedMatch. First I create the game and invite a couple of players.

I end the first players turn fine with endTurnWithNextParticipants:turnTimeout:matchData:completionHandler: and it goes to the second player.

When the second player does his turn, updates the match data, and updates the next participants, he tries calling the same endTurnWithNextParticipants:turnTimeout:matchData:completionHandler:, however I get an error.

GKErrorDomainCode = 17 "the requested operations could not be completed because one or more of the parameters are invalid"

The array of nextParticipants seems fine. All I do is put the current player at the end of the participants array, the turnTimeOut seems fine, I do the same thing as I did the first time, and the matchdata should be fine as well.

Is there something that I am missing? The only thing that I can thing of is that I am not properly accepting the invitation to the game or something like that. However, the documentation is unclear to me.

I have been trying to debug this for hours.

I would appreciate any help that you can give me! Thank you so much.

like image 654
user1859179 Avatar asked Dec 06 '12 01:12

user1859179


1 Answers

I had the same problem (or at least similar), but found a way out of it. The object you recieve (gamedata) should not be passed around like a pie. In my project, I needed to take the data, convert them to game objects, process them with the data that was handeled, and then convert it back to a data package, and then send it to the next player.

To me, it is the only way you can safely process the data, without mutating the original source.

Best of luck, hope it helped.

like image 143
Nils Munch Avatar answered Nov 20 '22 04:11

Nils Munch