Game Center invite fails immediately

We're having a problem with sending invites with GKGameCenterViewController. The view controller opens up just fine, but when we try to send an invite to somebody, it immediately fails. Both accounts have game center invites enabled and finding other players through the GKGameViewController works fine.


Here's the code we're using to manage the invites:

This method is called as soon as the GKLocalPlayer is authenticated (authentication is called from GameViewController, this code is in a separate Game Center managing class):


internal func authenticationChanged() {
     if GKLocalPlayer.localPlayer().authenticated && !authenticated { 
          print("Authentication changed: player authenticated") authenticated = true 
          GKLocalPlayer.localPlayer().unregisterAllListeners()
          GKLocalPlayer.localPlayer().registerListener(self)
     } else { 
          print("Authentication changed: player not authenticated") 
          authenticated = false 
          GKLocalPlayer.localPlayer().unregisterAllListeners()
     }     
}


And this is the method that should be called when the invite is received, although it it isn't called considering that the invite fails as soon as it is sent.

public func player(player: GKPlayer, didAcceptInvite inviteToAccept: GKInvite) {
     print("Accepted invite")
     let mmvc = GKMatchmakerViewController(invite: inviteToAccept)!
     mmvc.matchmakerDelegate = self
     presentingViewController.presentViewController(mmvc, animated: true, completion: nil)
}

These two pieces of code are all in the same class that conform to the GKMatchmakerViewControllerDelegate, GKGameCenterControllerDelegate, GKMatchDelegate, GKLocalPlayerListener delegates and protocols.


Stackoverflow question: http://stackoverflow.com/questions/32940421/game-center-invite-fails-immediately-swift

Replies

We're having the exact same problem. Currently running the Xcode 7.1 and Swift. We have checked all of the obvious settings on all involved devices to ensure that game center invites are enabled. No luck. The GKMatchmakerViewController shows "failed" very quickly after inviting another player, but automatching works just fine. (Our app is in development and not yet in the app store. Could this be the reason? If so, how can we test invitations?)

Same problem for me it immediately fails when i try to invite a friend.


I get this error in gamekit log but don't know how to solve.

invite failed with error: Error Domain=GKErrorDomain

UserInfo={GKServerStatusCode=5096, NSUnderlyingError=0x16664430

{Error Domain=GKServerErrorDomain Code=5096 "Peer device (type: iPhone) does not support a game compatible with: unknown:BUNDLE_ID:1.0:10"

UserInfo={GKServerStatusCode=5096, NSLocalizedFailureReason=Peer device (type: iPhone) does not support a game compatible with: unknown:BUNDLE_ID:1.0:10}},


Any help please ?

Hello,


I've also the same problem. Did you find a solution to let it work ?

On my side, the previous version of my app, that use deprecated method is still working correctly. I've the issue only with the new methods. My only idea is to test with TestFlight.


Thanks

In my case I find the issue : I was building to a new version. If I build and test with the version currently available on AppStore : it works.

We are experiencing this as well. We have a pre-release tvOS app. As soon as I invite a friend, it shows "Failed" almost instantly. I've searched around a bunch and haven't been able to find anything that I'm doing wrong.

Has anybody found a solution or workaround? We're hitting the exact same issue and we're blocked on being able to test invites.

Just found this: http://stackoverflow.com/questions/33902327/gkmatchmakerviewcontroller-failed.


Building the app in release mode fixes the issue for us.

I had the same issue. Solution for me was to invite another player.

As jd_dev said. A comment in this page explains. http://stackoverflow.com/questions/33902327/gkmatchmakerviewcontroller-failed.

We're seeing a similar problem with our custom UI invites to real time matches. We find that making arbitrary changes to the build version number can make the issue disappear/reappear. Have filed a radar: 26717939


Perhaps as robatmac says, keeping the build and version numbers the same as the store build until right before the update might be the way to go. But making a last minute change that you know will break your dev build, then trusting that it'll magically be fixed by iTunesConnect after release makes me uncomfortable.

Does anybody have solution for this because I immediately get Failed when I try to invite someone? The automatching is flawless.