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", }, }, }