I’m having trouble getting the game center to work with my app. Game Center never opens or does anything.
Corona Version: 2015.2731
I’ve got the Game Center settings set to Sandbox.
I’ve created a leaderboard on iTunes connect with the leaderboard ID = “com.goldenegg.highscore”
build.settings file
[lua]
settings =
{
orientation =
{
default = “portrait”,
},
iphone =
{
plist =
{
CFBundleDisplayName = “My Corona App”,
CFBundleName = “My Corona App”,
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-167.png”,
“Icon-Small-40.png”,
“Icon-Small-40@2x.png”,
“Icon-Small-40@3x.png”,
“Icon-Small-50.png”,
“Icon-Small-50@2x.png”,
“Icon-Small.png”,
“Icon-Small@2x.png”,
“Icon-Small@3x.png”
}, – Required
UILaunchImages = {}, – Required
UIApplicationExitsOnSuspend = false,
UIPrerenderedIcon = true,
UIStatusBarHidden = true,
MinimumOSVersion = “7.0”,
UIBackgroundModes = {“remote-notification”}, – Needed for OneSignal
},
},
plugins =
{
[“plugin.OneSignal”] =
{
publisherId = “com.onesignal”,
},
[“plugin.google.play.services”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { android=true, [“android-kindle”]=true },
},
[“CoronaProvider.analytics.flurry”] =
{
publisherId = “com.coronalabs”
},
[“CoronaProvider.gameNetwork.google”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { android=true }
},
[“CoronaProvider.native.popup.social”] =
{
publisherId = “com.coronalabs”
},
[“CoronaProvider.gameNetwork.apple”] =
{
publisherId = “com.coronalabs”,
supportedPlatforms = { iphone=true, [“iphone-sim”]=true },
},
},
}
[/lua]
–game.lua file
[lua]
–At the top of the file I have
local gameNetwork = require( “gameNetwork” )
local loggedIntoGC = false
local function initCallback( event )
if ( event.type == “showSignIn” ) then
– This is an opportunity to pause your game or do other things you might need to do while the Game Center Sign-In controller is up.
elseif ( event.data ) then
loggedIntoGC = true
native.showAlert( “Success!”, “”, { “OK” } )
end
end
local function onSystemEvent( event )
if ( event.type == “applicationStart” ) then
gameNetwork.init( “gamecenter”, initCallback )
return true
end
end
Runtime:addEventListener( “system”, onSystemEvent )
–When the leaderboards button is clicked
local function go_LeaderBoards()
gameNetwork.show( “leaderboards” )
–[[gameNetwork.show( “leaderboards”,
{
leaderboard = {
category = “1”
},
listener = showLeaders
}
)
]]
end
[/lua]