Show Leaderboards in Game Center crashes most of the time

iOS 9.1. Xcode 7.1. OS: El Capitan (10.11.1), Corona SDK build 2015.2751 (2015.10.27)

I just built and deployed a dev version of my app, which uses the Composer API. I’m invoking the GC login in my main.lua file just before my composer.gotoScene command. That goes to splash.lua, and then onto play.lua once the user clicks a button. It’s in play.lua that I show the leaderboard using the following function, which is tied to a button widget:

function goToLeaderboard() if loggedIntoGC == true then gameNetwork.show( "leaderboards", { timeScope="Week" } ); else offlineAlert(); end end

The app runs on the device and logs into GC into my dev account. I

The problem is that when I show the leaderboard, it opens GC fine and shows the single leaderboard (entitled “Leaderboard”. I tap that. Sometimes, it opens it and shows the single test entry (me). Most of the time, the app quits to the desktop.

I don’t know if this is relevant or not, but I’m using particle emitters made in Particle Designer. I’m so close to finishing this project, but this is making me crazy. I’m posting my main.lua file and the relevant portions of play.lua here. I’ve also attached two crash logs…the Game Center crash log (gc-crash.txt) and the app crash log (wraith-crash.txt).

In my main.lua file, I’ve got the following code:

local composer = require("composer") local gameNetwork = require ("gameNetwork") function onComplete( event ) if event.action == "clicked" then local i = event.index if i == 1 then end end end function initCallback( event ) if event.data then loggedIntoGC = true native.showAlert( "Success!", "User has logged into Game Center", { "OK" } ) else loggedIntoGC = false native.showAlert( "Not logged in", "User is not logged into Game Center", { "OK" } ) end end function onSystemEvent( event ) if event.type == "applicationStart" then gameNetwork.init( "gamecenter", initCallback ) return true else end end Runtime:addEventListener("system", onSystemEvent) function offlineAlert() native.showAlert("Not logged in", "You're not connected to the Game Center", {"Oops!"}, onComplete) print ("you're not connected to Game Center") end composer.gotoScene("splash", {"fadein"})

Here’s the build.settings file:

settings = { orientation = { -- Supported values for orientation: -- portrait, portraitUpsideDown, landscapeLeft, landscapeRight default = "portrait", supported = { "portrait", } }, plugins = { ["CoronaProvider.gameNetwork.apple"] = { publisherId = "com.coronalabs", supportedPlatforms = { iphone=true, ["iphone-sim"]=true }, }, }, excludeFiles = { -- Include only the necessary icon files on each platform iphone = { "Icon-\*dpi.png", }, android = { "Icon.png", "Icon-Small-\*.png", "Icon\*@2x.png", }, }, -- -- iOS Section -- iphone = { plist = { UIStatusBarHidden = false, UIPrerenderedIcon = true, -- set to false for "shine" overlay --UIApplicationExitsOnSuspend = true, -- uncomment to quit app on suspend CFBundleIconFiles = { "Icon.png", "Icon@2x.png", "Icon-60.png", "Icon-60@2x.png", "Icon-60@3x.png", "Icon-72.png", "Icon-72@2x.png", "Icon-76.png", "Icon-76@2x.png", "Icon-Small.png", "Icon-Small@2x.png", "Icon-Small@3x.png", "Icon-Small-40.png", "Icon-Small-40@2x.png", "Icon-Small-50.png", "Icon-Small-50@2x.png", }, --[[-- iOS app URL schemes: CFBundleURLTypes = { { CFBundleURLSchemes = { "fbXXXXXXXXX", -- replace XXXXXXXXX with your Facebook appId } } } --]] } }, -- -- Android Section -- android = { usesPermissions = { "android.permission.INTERNET", }, }, }

Bueller? Bueller?

Your code to show the leaderboard looks fine and I’m 99.9% sure that in iOS 9+ Game Center is totally busted on iOS.  Apple need to come up with a fix.  If you launch the Game Center app in iOS it crashes and for me shows an empty white screen.  It’s gotta be related to that.

That’s comforting, I guess. :slight_smile:

Thanks for the reply. I’ll check GC in one of my other apps that uses it (didn’t even occur to me that it might be a global problem).

David

OK, so I did a little more testing. GC works on one of my earlier apps on the same device, signed into the same account. Hmmm.

Still crashes in my new app using the above code while logging into my account.

HOWEVER, I tried deploying this on an iPad Mini logged into a different account and it didn’t crash when showing the leader board…the first time.

Then I logged out of the mini and logged in with my account, tried showing the leader board and it crashed.

I logged out of my account and logged into the mini with the other account that worked before. Now it crashes when I try to view the leader board. Every time. Ugh…this is so frustrating.

David

Hi David,

Can you test out our sample Game Center project and see if you experience the same crashes? It’s located in your local Corona application folder here:

SampleCode > GameNetwork > GameCenter

Thanks,

Brent

Hi Brent,

Yes, I just built the GameCenter app and deployed it to my same device. It worked flawlessly when I show the leaderboard. I tapped until it got to well over 10,000 points and still no crashes. Restarted app, tried it again. Still all good.

Mine worked once or twice showing the leaderboard, then it started crashing after that. I get the leaderboard for the app open, but then when I choose a leaderboard (I only have one), that’s when it summarily quits.

David

Hi David,

That is odd (but potentially a good sign?). Note that our test app uses Apple’s “GKTapper” test environment. Perhaps your leaderboard(s) are set up differently in iTunes Connect? Or perhaps it’s really a core Game Center issue that affects other apps that use real leaderboards (not Apple’s test sandbox).

Brent

On that note, I think you can actually test our sample app with your own Game Center account (however, the UI may get all messed up if you have like 10 different leaderboards or something). Just go into the project’s “build.settings” file, change the value for “CFBundleIdentifier” to your GC account, and re-build the app.

Brent

Well, it’s weird that my other app, which is live, uses the live leaderboard and it works fine. The difference between that one and my current one is that the old one uses a time-based scoring system (where lowest is best) whereas my current one is integer-based in which highest score is best. That one is not yet live…just in testing.

There was a change from iOS 8 to 9 where you had to have sandbox enabled on the device to test GC. There were warnings about using your “real” GC persona for testing, so I avoided that. The sandbox has gone away and it appears to accept any Apple ID now for testing. But any ID I use exhibits this behavior. 

I’ve gone in and tried to confirm that I’ve not done anything boneheaded in my iTunesConnect when setting up my GC leaderboards. If anything, it’s a lot simpler than the previous one I set up.

David

I tried replacing the CFBundleIdentifier in the Game Center to my app’s ID and it worked just fine when showing the leaderboard (there is only 1). I tried swapping the CFBundleIdentifier in my own app to point to com.apple.GKTapper within my app, and THAT worked too.

I hadn’t specified a CFBundleIdentifier in my build.settings before…wasn’t aware that I needed to (maybe not?) Anyway, I pointed the CFBundleIdentifier in my app to my own, built it, but it still crashes when I show the leaderboard. I’m at a loss right now. I was thinking it was my leaderboard in iTunes Connect, but now I’m thinking it isn’t, since my leaderboard works fine in your app. :confused:

David

Interestingly enough, I find when I deploy my app for the first time on the device and then go directly into the leaderboard, I am able to show it without a crash. For some reason it’s showing a score that I thought I’d wiped form the leader board. :confused:

But when I play the game and the show the leaderboard in the middle of the game (or after it’s over, it crashes. Hmmm…

David

OK, so I just realized that “delete test data” isn’t an immediate thing. I’m going to wait to see if that data gets wiped in the next day and then try re-testing.

Are you testing on an iPad or iPhone?

I installed same code base on my sons iPad and the leaderboard always loads. On my iPhone with same code base the leaderboard never loads.

Both devices are iOS 9.1

It happens on both my iPhone 6S and my iPad Mini.

David

Bueller? Bueller?

Your code to show the leaderboard looks fine and I’m 99.9% sure that in iOS 9+ Game Center is totally busted on iOS.  Apple need to come up with a fix.  If you launch the Game Center app in iOS it crashes and for me shows an empty white screen.  It’s gotta be related to that.

That’s comforting, I guess. :slight_smile:

Thanks for the reply. I’ll check GC in one of my other apps that uses it (didn’t even occur to me that it might be a global problem).

David

OK, so I did a little more testing. GC works on one of my earlier apps on the same device, signed into the same account. Hmmm.

Still crashes in my new app using the above code while logging into my account.

HOWEVER, I tried deploying this on an iPad Mini logged into a different account and it didn’t crash when showing the leader board…the first time.

Then I logged out of the mini and logged in with my account, tried showing the leader board and it crashed.

I logged out of my account and logged into the mini with the other account that worked before. Now it crashes when I try to view the leader board. Every time. Ugh…this is so frustrating.

David

Hi David,

Can you test out our sample Game Center project and see if you experience the same crashes? It’s located in your local Corona application folder here:

SampleCode > GameNetwork > GameCenter

Thanks,

Brent