Getting GameCenter invite friend to work (iOS9?)
Asked Answered
A

0

6

I cannot get GameCenter invite friend to work. The match maker view controller shortly shows the invited player and a little text "Failed" under it. Maybe I picked the wrong time to learn GameCenter, as quite a few people report difficulties with iOS9. But maybe there is a solution somewhere.

Basics:

  1. iTunesConnect App record exists, app is not public, GameCenter is enabled, one leaderboard has been created, two sandbox users have been created (different from my main apple id)
  2. The app has one view controller, which for now shall handle all GameCenter things
  3. In viewDidLoad the player authentication is started by assigning a block to [GKLocalPlayer localPlayer].authenticateHandler. In the block the passed in view controller is shown (if there is one). This works.
  4. The view controller is set as GKGameCenterControllerDelegate and it works, the "didFinish" call is received and I dismiss the GameCenter view controller there.
  5. In the authenticateHandler block, when the player is authenticated, I set the view controller as listener with [[GKLocalPlayer localPlayer] registerListener:...];. A method stub for all GKLocalPlayerListener methods is implemented with a log call.
  6. When tapping a certain button, I create a GKMatchRequest and the GKMatchmakerViewController, set my view controller as matchmaker delegate and present the matchmaker view controller. Again all delegate methods are implemented with log calls.
  7. I can run the app, in the matchmaker view controller tap "invite friend" and follow the screens until I tap the "Send" button. Then the invited player is shown on the right slot, shortly "Failed" is shown below it and "Auto-match" is shown again.
  8. No player listener methods are called.

Questions:

  1. Do I need to enable push notifications to make invite friends work? (If yes, where is this documented?)
  2. Is it possible to test invite friends between simulator/simulator or device/simulator or only device/device?
  3. What does "No registration for peer" mean in the GameKit log from a device? (see below)

Other resources:

  1. Is Game Center Multiplayer Friends broken in IOS 9? (Oct/2015)
  2. How to solve inviting friend over game center? (2013)
  3. http://www.raywenderlich.com/60980/game-center-tutorial-how-to-make-a-simple-multiplayer-game-with-sprite-kit-part-1 (CatRace - March/2014)
  4. Game Center invite fails immediately (Oct/2015)

GameKit Logs:

I turned on GameCenter logging in the settings on my iPhone and exported the logs. The first thing, which caught my attention is this "No registration for peer (...)":

<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:

Forgot the next entry from the log: (manually wrapped)

[(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 non-sandbox accounts on two devices attached to two different macs running Xcode 7.1 / both devices on iOS 9.1. In either direction I still get the "Failed" message in the game center match maker screen.

Avatar answered 15/10, 2015 at 10:58 Comment(2)
Is the invitee a sandbox account?Ignominy
Yes, I'm trying to test this between sandbox accounts only.Avatar

© 2022 - 2024 — McMap. All rights reserved.