I can't get GameCenter to invite a friend to work. The Match Maker view controller will soon display the invited player and the small text “Failed” below it. Perhaps I have chosen the wrong time to learn GameCenter, as many people report difficulties with iOS9. But perhaps there is a solution somewhere.
The basics:
- An iTunesConnect App record exists, the application is not publicly available, GameCenter is turned on, one leaderboard is created, two sandbox users are created (different from my main Apple ID).
- The app has one view controller that will now handle all of the GameCenter stuff.
- In
viewDidLoad , player authentication begins by assigning the [GKLocalPlayer localPlayer].authenticateHandler . The block shows the controller transmitted in the field of view (if any). It works. - The view controller is set as
GKGameCenterControllerDelegate , and it works, the didFinish call is called, and I reject the GameCenter view controller there. - In the authenticateHandler block, when the player is authenticated, I set the view controller as a listener using
[[GKLocalPlayer localPlayer] registerListener:...]; . The method stop for all GKLocalPlayerListener methods GKLocalPlayerListener implemented using a log call. - When you click a specific button, I create a
GKMatchRequest and a GKMatchmakerViewController , set my view controller as a matchmaker delegate, and present a matchmaker view controller. Again, all delegate methods are implemented using log calls. - I can start the application, in the matchmaker view controller, tap “invite a friend” and follow the screens until I click the “Send” button. Then the invited player is displayed in the right slot, soon “Failed” is displayed below it, and “Auto-match” is displayed again.
- The call to the listener methods is not performed.
Questions:
- Do I need to enable push notifications to get friends to work? (If so, where is this documented?)
- Is it possible to test the invitation of friends between a simulator / simulator or a device / simulator or only a device / device?
- What does “No Peer Registration” mean in GameKit from a device? (see below).
Other resources:
GameKit Logs:
I turned on GameCenter by logging into the settings on my iPhone and exporting logs. The first thing that caught my attention was "No registration for peers (...)":
<NSHTTPURLResponse: 0x167a2cc0> { URL: https://service.gc.apple.com/WebObjects/GKInvitationService.woa/wa/initiate } { status code: 200, headers { ... } ... status: (200) no error header: <CFBasicHash 0x165e6480 [0x3b6633e8]>{type = immutable dict, count = 10, entries => ... body: <CFBasicHash 0x17811ad0 [0x3b6633e8]>{type = mutable dict, count = 4, entries => ... 3 : <CFString 0x38bc0f78 [0x3b6633e8]>{contents = "message"} = <CFString 0x165c0610 [0x3b6633e8]> {contents = "No registration for peer (G:<stripped>/?/?)"} ... 9 : <CFString 0x38bb53d8 [0x3b6633e8]>{contents = "status"} = <CFNumber 0x165cacc0 [0x3b6633e8]>{value = +5030, type = kCFNumberSInt64Type} }
EDIT 1:
I forgot the following entry from the journal: (manual packaging)
[(gamed:123:NO):Error] invite failed with error: Error Domain=GKErrorDomain Code=3 "The requested operation could not be completed due to an error communicating with the server." UserInfo={GKServerStatusCode=5030, NSUnderlyingError=0x167528a0 {Error Domain=GKServerErrorDomain Code=5030 "No registration for peer (<stripped>)" UserInfo={GKServerStatusCode=5030, NSLocalizedFailureReason=No registration for peer (<stripped>)}}, NSLocalizedDescription=The requested operation could not be completed due to an error communicating with the server.}
EDIT 2:
I tested with two accounts without a sandbox on two devices connected to two different Macs running on Xcode 7.1 / both devices on iOS 9.1. In any direction, I still get a "Failed" message on the game center match creation screen.
source share