Can't get Game Center to work

Hi you all, I have followed the tutorial that can be found @ https://coronalabs.com/blog/2012/01/17/tutorial-game-center-integration-ios/ to integrate the Game Center in my game.

The code I’m using is: 

local gameNetwork = require "gameNetwork" local loggedIntoGC = false -- called after the "init" request has completed local function initCallback( event ) if event.data then loggedIntoGC = true native.showAlert( "Success!", "User has logged into Game Center", { "OK" } ) else loggedIntoGC = false native.showAlert( "Fail", "User is not logged into Game Center", { "OK" } ) end end -- function to listen for system events local function onSystemEvent( event ) if event.type == "applicationStart" then gameNetwork.init( "gamecenter", initCallback ) return true end end Runtime:addEventListener( "system", onSystemEvent )

 and I always get “Fail, User is not logged into Game Center”.

Of course I have enabled the Game Center in iTunes Connect.

Then, I would like to show the leatherboard, that I have setted up via iTunes Connect.

According to the Corona documentation, the code I have to use is:

gameNetwork.show( "leaderboards", { leaderboard = { category = "com.appledts.EasyTapList" }, listener = onGameNetworkPopupDismissed } )

but what does “category” stand for? Is it the leatherboard ID?

Thanks.

Are you testing this on a device?

Yes, I’m testing it on the iPhone 6 Plus (iOS 8.4.1)

Hi @estiennelorenzo,

Three comments here:

  1. 99% likely reason for this issue is that on iOS 8.x, you need to enable to Game Center “sandbox” for testing. On the device, go under Settings > Game Center and look for the “Sandbox” switch (then turn it on). If that switch does NOT appear there, make sure that your device is configured as a “Developer” device within Xcode.

  2. Trying to show the “com.appledts.EasyTapList” leaderboard isn’t really applicable to your own test app. That’s a leaderboard used for testing with Apple’s “GKTapper” account. You should specify your own leaderboard category instead.

  3. I do not recommend using that ancient tutorial on Game Center. Some of it may still be valid, but a better resource is actually the documentation for the Game Center plugin:

https://docs.coronalabs.com/plugin/gameNetwork-apple/index.html

Best regards,

Brent

Hi Brent, thank you, now it is working.

You were right, the sandbox switch was turned off.

Also thanks for the brand new documentation.

BR,

Lorenzo.

Just one more thing @Brent Sorrentino. Does “category” stand for “Leatherboard ID” in iTunes Connect?

Thanks. 

Hi again,

Yes, “category” represents the leaderboard ID. :slight_smile:

Brent

Are you testing this on a device?

Yes, I’m testing it on the iPhone 6 Plus (iOS 8.4.1)

Hi @estiennelorenzo,

Three comments here:

  1. 99% likely reason for this issue is that on iOS 8.x, you need to enable to Game Center “sandbox” for testing. On the device, go under Settings > Game Center and look for the “Sandbox” switch (then turn it on). If that switch does NOT appear there, make sure that your device is configured as a “Developer” device within Xcode.

  2. Trying to show the “com.appledts.EasyTapList” leaderboard isn’t really applicable to your own test app. That’s a leaderboard used for testing with Apple’s “GKTapper” account. You should specify your own leaderboard category instead.

  3. I do not recommend using that ancient tutorial on Game Center. Some of it may still be valid, but a better resource is actually the documentation for the Game Center plugin:

https://docs.coronalabs.com/plugin/gameNetwork-apple/index.html

Best regards,

Brent

Hi Brent, thank you, now it is working.

You were right, the sandbox switch was turned off.

Also thanks for the brand new documentation.

BR,

Lorenzo.

Just one more thing @Brent Sorrentino. Does “category” stand for “Leatherboard ID” in iTunes Connect?

Thanks. 

Hi again,

Yes, “category” represents the leaderboard ID. :slight_smile:

Brent