Hi,
I have looked around the forums and seen a few topics on this, but nothing that seems to fix my issue. My game is live. I first noticed the problem while testing but read somewhere that the problem might be a testing issue so I decided to publish and see what happens. On itunes connect I can see that there are at least 50 scores, but they are all zero.
I think it must be something to do with my setup as the code is “adding” a high score, its just zero for everyone. I think I have set up itunes correctly, but I may be wrong.
Below is my code. I tried [lua]tonumber(score)[/lua] and [lua]score[/lua]. Score is a number anyway, but I was clutching at straws.
[lua]
local leaderboardID = “com.zeroIQTest.BestScore”
– some other code
public.leaderBoardSubmit = function(score)
local function requestCallback( event )
if ( event.type == “setHighScore” ) then
– High score has been set
print(“setHighScore callback” )
table.print_r(event)
end
end
print("----------------the score is ", score) – this prints correctly so I know score is getting here
– this is my original code, commented to test fixed value
– gameNetwork.request( “setHighScore”,
– {
– localPlayerScore = { category=leaderboardID, value=tonumber(score) },
– listener = requestCallback
– }
– )
– added this code to test fixed value
gameNetwork.request( “setHighScore”,
{
localPlayerScore = { category=leaderboardID, value=25 },
listener = requestCallback
}
)
end
[/lua]
This is what is printed out in the callback.
table: 0x622a670 { [provider] =\> "gamecenter" [type] =\> "setHighScore" [data] =\> table: 0x622a670 { [value] =\> 25 [category] =\> "com.zeroIQTest.BestScore" } }
Any ideas on where I am going wrong?
Thanks,
Craig