[RESOLVED] Game Center console error

Hi,

I have added game center to my game and run thru the adding of the high score leaderboard and the achievements in the itunes connect portal.  I used the example and added the line to my build.settings etc.

When I test the code on my ipad I get nothing… I look in the console of xcode for the attached ipad and I see as soon as my game tries to “unlock” an achievement “Warning game center is not available for this platform”   it is an ipad … it has game center installed … it is running iOS 6.1.3.

and I am building with an adhoc profile so I can test appropriately… it is obviously firing game center code but this error follows right after.

Any ideas here?

You have to logout of game center before running your app and use a test account to login into the sandbox’ed version.  It will show you the words (sandbox) when you are properly in the testing environment.  AdHoc only works with the sandbox from my experience. 

Also be aware that it can take time for your scores to show up in leaderboards in the sandbox’ed GameCenter, usually it takes two scores to be set by different accounts before they show up.

I logged out of game center and then loaded the app and I still get this error in the console when the first achievement is triggered to unlock.

<Warning>: WARNING: The ‘gameNetwork’ library is not available on this platform.

this is in my build settings…

components = {}

this is how I enable game center in the main.lua file.

local gameNetwork = require “gameNetwork”

local function initCallback(event)

if event.data then

loggedIntoGC = true

else

loggedIntoGC = false

end

end

local function onSystemEvent(event)

if event.type == “applicationStart” then

gameNetwork.init(“gamecenter”, initCallback)

return true

end

end

Runtime:addEventListener(“system”,onSystemEvent)

later I start unlocking in this format which would be the first thing that game center would see other than the login.

local function requestCallback(event)

end

gameNetwork.request(“unlockAchievement”, { achievement = { identifier=“com.coinadventure.onemin”, percentComplete=100,showCompletionBanner=true,}, listener=requestCallback})

Two quick questions:

  • Do you check that Game Center logged in successfully before calling gameNetwork.request()?  If you call gameNetwork.request() when you’re not logged in, you might get the error you’re seeing.  You can put some print statements in initCalllback to check whether the login is working, and that it completes before you call gameNetwork.request()

  • Do you have local gameNetwork = require “gameNetwork” in the module where you call gameNetwork.request()?

  • Andrew

ok… found the error.  I moved the initCallback and the runtime to the bottom of my main.lua outside any other distractions and I am currently and happily using Game Center with no issues in sandbox mode.

Sometimes stripping it all back to just the issue you have can make the difference.

Thanks for the second and third pair of eyes guys!

Matt

You have to logout of game center before running your app and use a test account to login into the sandbox’ed version.  It will show you the words (sandbox) when you are properly in the testing environment.  AdHoc only works with the sandbox from my experience. 

Also be aware that it can take time for your scores to show up in leaderboards in the sandbox’ed GameCenter, usually it takes two scores to be set by different accounts before they show up.

I logged out of game center and then loaded the app and I still get this error in the console when the first achievement is triggered to unlock.

<Warning>: WARNING: The ‘gameNetwork’ library is not available on this platform.

this is in my build settings…

components = {}

this is how I enable game center in the main.lua file.

local gameNetwork = require “gameNetwork”

local function initCallback(event)

if event.data then

loggedIntoGC = true

else

loggedIntoGC = false

end

end

local function onSystemEvent(event)

if event.type == “applicationStart” then

gameNetwork.init(“gamecenter”, initCallback)

return true

end

end

Runtime:addEventListener(“system”,onSystemEvent)

later I start unlocking in this format which would be the first thing that game center would see other than the login.

local function requestCallback(event)

end

gameNetwork.request(“unlockAchievement”, { achievement = { identifier=“com.coinadventure.onemin”, percentComplete=100,showCompletionBanner=true,}, listener=requestCallback})

Two quick questions:

  • Do you check that Game Center logged in successfully before calling gameNetwork.request()?  If you call gameNetwork.request() when you’re not logged in, you might get the error you’re seeing.  You can put some print statements in initCalllback to check whether the login is working, and that it completes before you call gameNetwork.request()

  • Do you have local gameNetwork = require “gameNetwork” in the module where you call gameNetwork.request()?

  • Andrew

ok… found the error.  I moved the initCallback and the runtime to the bottom of my main.lua outside any other distractions and I am currently and happily using Game Center with no issues in sandbox mode.

Sometimes stripping it all back to just the issue you have can make the difference.

Thanks for the second and third pair of eyes guys!

Matt