OGeek|极客世界-中国程序员成长平台

标题: ios - 卡住试图让 Game Center 排行榜工作 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-12 19:44
标题: ios - 卡住试图让 Game Center 排行榜工作

我正在尝试让 gamecenter 排行榜工作,但卡住了。我正在 Xcode 模拟器上进行测试,因为我无法在设备上登录我们的沙盒帐户。我可以使用init函数通过游戏登录沙盒帐户,但排行榜没有显示在gamecenter中。在游戏下方显示我们的游戏,但在下方显示“没有排行榜或成就”。我在 itunes connect 中设置了排行榜,并在似乎有效的代码中请求 setHighScore。以下是相关代码:

local function updateCallback(e)
    local data = json.encode( e.data )

    -- show encoded json string via native alert
    native.showAlert( "e.data", data, { "OK" } )
end

--[[
    Update the gamecenter learderboard for gamescore.
]]--
function [app name]GameNetwork.updateGamescore()
    --Sets the score if it is higher than the one on Apple's server
    gameNetwork.request( "setHighScore",
    {
        localPlayerScore = { category = "com.[domain].[game].gamescore", value = gamescore },
        listener = updateCallback
    })
end

按预期显示更新回调

{"value": 25,"category":"com.[domain].[game].gamescore"}

当调用 updateGamescore 函数时。我错过了什么吗? gamenetwork api有什么好的教程吗?

Cross-post from corona forum



Best Answer-推荐答案


终于明白了。问题在于应用程序 ID。我们的临时配置文件有一个通配符,而我们的应用商店没有。我使用特定的应用程序 ID 创建了一个新的临时配置文件,并且排行榜立即出现。此外,我们的临时配置文件使用的证书与应用商店证书不同,因此这也可能是问题所在。

关于ios - 卡住试图让 Game Center 排行榜工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22122219/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://sqlite.in/) Powered by Discuz! X3.4