Questions tagged [gkturnbasedmatch]

The GKTurnBasedMatch class allows your game to implement turn-based matches between sets of players on Game Center. A turn-based match uses a store-and-forward approach to share data between the participants.

The GKTurnBasedMatch class allows your game to implement turn-based matches between sets of players on Game Center. A turn-based match uses a store-and-forward approach to share data between the participants.

When a player participating in the match performs actions that advance the state of the match, your game describes the new state of the match and decides which player acts next. The next player to act is notified by a push notification.

Later, when the next player launches your game, you download the match data from Game Center and continue the match. Players take turns acting (based on whatever internal logic your game implements) until the match ends.

One advantage of turn-based matches is that a player may participate in multiple matches simultaneously.

104 questions
1
vote
1 answer

GKTurnBasedMatch: Unable to get GKLocalPlayerListener delegate methods called on saveCurrentTurn(withMatch .. )?

I'm trying to save match data with the Game Centre default function. The following function works pretty fine and things got saved. self.myMatch?.saveCurrentTurn(withMatch: dataToSend, completionHandler: { (e) in print(e ?? "No Error:") …
Asim Khan
  • 508
  • 1
  • 7
  • 21
1
vote
1 answer

Retry endTurnWithNextParticipants

I want to handle the error case where endTurnWithNextParticipants fails. I therefore store match data by calling the cacheFailedEndTurnWithNextParticipants method at the end of this post. I provided the function only for reference. The problem is…
Fredrik Johansson
  • 1,301
  • 1
  • 13
  • 26
1
vote
1 answer

How to define a timeout for Matchmaking process without waiting for long in TurnBasedGame?

I end the turn like this , but i want to give an time-out for searching for player , issue that i'm having is turnTimeout only works for active players , but not working for status "matching" . Is there another way to stop matchmaking after a give…
nan
  • 11
  • 3
1
vote
1 answer

How to actually start a GKTurnBasedMatch so that I can send an exchange?

I'm trying to send an exchange to another player in a GKTurnBasedMatch. When I send it, my completion handler gets a big error message, with these descriptions: The requested operation could not be completed because the session is in an invalid…
Le Mot Juiced
  • 3,761
  • 1
  • 26
  • 46
1
vote
1 answer

How to get notified when a player "Remove" a match in progress from GKTurnBasedMatchmakerViewController

I am using the default GKTurnBasedMatchmakerViewController. A player can "Remove" a match in progress by sliding the match cell to the left and then tapping the red "Remove" button. But this does not notify the other player that the first one has…
1
vote
1 answer

Game Center Sandbox issue

I faced with a very old problem that has been discussed here many times. Despite talking the problem much time I found no acceptable solution so I decided to raise the issue once again. So, the problem. I'm trying to test a turn-based match. I use…
1
vote
1 answer

How to reliably determine which match got created in response to GKTurnBasedMatchmakerViewController success

On iOS 10 I am trying to create a match using the GKTurnBasedMatchmakerViewController. I can bring up the view so the user can choose matchmaking or an invite. I can't figure out how to reliably determine which match got created in response to…
Eric Zinda
  • 787
  • 7
  • 15
1
vote
1 answer

GKTurnBasedMatch currentParticipant becomes nil after saveCurrrentTurn

I have a method that gets called whenever a new match is created (it setups the game data), and it works well, except sometimes (randomly) the current participant becomes nil after I try to save the data. I've placed a couple of breakpoints, and up…
coopersita
  • 5,011
  • 3
  • 27
  • 48
1
vote
1 answer

GKTurnBasedMatch how to accept a new match invitation

What is the correct way to programmatically accept a match invitation with GameKit's standard user interface? I am seeing an expectedState="Invited" foundState="Active" exception Optional(Error Domain=GKErrorDomain Code=22 "The requested operation…
sdc
  • 2,603
  • 1
  • 27
  • 40
1
vote
1 answer

GameCenter - GKTurnBasedMatch.loadMatchesWithCompletionHandler returns nil array

I've set up GameCenter turn-based matches for my game. Right now I'm just trying to display a list of the current matches for the current GK player. Here's my code: GKTurnBasedMatch.loadMatchesWithCompletionHandler { (matchesOpt, errorOpt) in …
Michael B
  • 11
  • 2
1
vote
0 answers

GKMatchRequest.playergroup=0 not matching to any existing match

The Apple documentation at https://developer.apple.com/library/ios/documentation/GameKit/Reference/GKMatchRequest_Ref/#//apple_ref/occ/instp/GKMatchRequest/playerGroup says: "Setting the playerGroup property to 0 allows the player to be matched into…
1
vote
0 answers

Disable invite banner

When I invite a player to a turn based match in iOS Game-Center a Game Center banner is shown on top of the screen in the receiving side (at least most of the times, the functionality seems to be shaky). I don't want a banner, but I want to handle…
Fredrik Johansson
  • 1,301
  • 1
  • 13
  • 26
1
vote
0 answers

receivedTurnEventForMatch fails to trigger

I'm working on a turn based game in Swift. The game uses a GKLocalPlayerListener to know when the other person has done their turn. The method player(player: GKPlayer, receivedTurnEventForMatch match: GKTurnBasedMatch, didBecomeActive: Bool) does…
Hamzah Malik
  • 2,540
  • 3
  • 28
  • 46
1
vote
1 answer

GKTurnBasedMatch does not advance to next player

So my match has two players. When the player 1, creates a new match, I use endTurnWithNextParticipants method and supply the nextParticipants with GKTurnBasedMatch's participants array property which has two participants. But on the player 1…
EmilyJ
  • 872
  • 2
  • 8
  • 19
1
vote
0 answers

Adding Game Center turn-based multiplayer to an existing bundle id

I'm trying to add TBM to an app that already had a few versions released on the App Store (including game center leaderboards). To get started, I first created a new test app on itunes connect and implemented all the basic methods I would need;…