Google 玩游戏 Android 排行榜意外响应代码 410
Google Play Games Android Leaderboard Unexpected response code 410
我正在 Unity 中实现 Google Play 游戏排行榜,我正在制作 UI 以查看排行榜,为此,我正在使用:
SDK: https://github.com/playgameservices/play-games-plugin-for-unity
Google Play Service version: 9.4.0
当我使用 PlayGamesPlatform 中的 LoadScores 方法时 class 没关系,return 用户,分数等,但是,为了获得更多用户,我需要使用 LoadMoreScores 方法,这就是问题所在。
当我使用 LoadMoreScores 方法时,在日志中,Android return 没有 return 更多玩家:
E/Volley: [5566] BasicNetwork.performRequest: Unexpected response code 410 for https://www.googleapis.com/games/v1/leaderboards/LeaderboardID/window/PUBLIC?timeSpan=ALL_TIME&language=en_US&maxResults=10&pageToken=LeaderboardNextToken&returnTopIfAbsent=true
W/LeaderboardAgent: Failed to retrieve leaderboard scores for GameID LeaderboardID ALL_TIME
com.android.volley.ServerError
at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms:163)
at iss.performRequest(:com.google.android.gms:64)
at com.android.volley.NetworkDispatcher.run(:com.google.android.gms:113)
W/LeaderboardAgent: {"errors":[{"domain":"global","reason":"PaginationTokenInvalid","message":"The passed token does not match the arguments of the request. Token: LeaderboardNextToken"}],"code":410}
我在 Unity3D 中针对此错误的代码是:
/// <summary>
/// Loads the scores using the provided parameters.
/// </summary>
/// <param name="leaderboardId">Leaderboard identifier.</param>
/// <param name="start">Start either top scores, or player centered.</param>
/// <param name="rowCount">Row count. the number of rows to return.</param>
/// <param name="collection">Collection. social or public</param>
/// <param name="timeSpan">Time span. daily, weekly, all-time</param>
/// <param name="callback">Callback to invoke when completed.</param>
PlayGamesPlatform.Instance.LoadScores(
"LeaderboardID", //The original ID obviously
LeaderboardStart.PlayerCentered,
10,
LeaderboardCollection.Public,
LeaderboardTimeSpan.AllTime,
(success) =>
{
leaderboardScoreData = success;
//Do Anything...
}
);
并在 LoadScores 之后的按钮...
/// <summary>
/// Loads more scores.
/// </summary>
/// <remarks>This is used to load the next "page" of scores. </remarks>
/// <param name="token">Token used to recording the loading.</param>
/// <param name="rowCount">Row count.</param>
/// <param name="callback">Callback invoked when complete.</param>
PlayGamesPlatform.Instance.LoadMoreScores(
leaderboardScoreData.NextPageToken,
10,
(success) =>
{
//Looking the returned object
Debug.Log("Load more scores info: " + success.ToString());
//Do Anything...
}
);
那个Debug.Logreturn:
I/Unity: Load more scores info: [LeaderboardScoreData: mId=LeaderboardID, mStatus=SuccessWithStale, mApproxCount=0, mTitle=]
下一页标记和上一页标记有一个正确的标记,但 Google 播放服务不能使用它,mTitle 在 LeaderboardScoreData 中无效。
谁能告诉我如何解决这个令牌错误?
我可以用其他方法得到其他分数吗?我不能再次使用 LoadScore,因为重新开始加载用户周围的用户,或者如果我能做到我不知道该怎么做。
对于未来的问题,最后的修复是:
在 https://console.developers.google.com/apis/dashboard 中激活 Google Play 服务,令牌将正常工作。
我正在 Unity 中实现 Google Play 游戏排行榜,我正在制作 UI 以查看排行榜,为此,我正在使用:
SDK: https://github.com/playgameservices/play-games-plugin-for-unity
Google Play Service version: 9.4.0
当我使用 PlayGamesPlatform 中的 LoadScores 方法时 class 没关系,return 用户,分数等,但是,为了获得更多用户,我需要使用 LoadMoreScores 方法,这就是问题所在。
当我使用 LoadMoreScores 方法时,在日志中,Android return 没有 return 更多玩家:
E/Volley: [5566] BasicNetwork.performRequest: Unexpected response code 410 for https://www.googleapis.com/games/v1/leaderboards/LeaderboardID/window/PUBLIC?timeSpan=ALL_TIME&language=en_US&maxResults=10&pageToken=LeaderboardNextToken&returnTopIfAbsent=true
W/LeaderboardAgent: Failed to retrieve leaderboard scores for GameID LeaderboardID ALL_TIME
com.android.volley.ServerError
at com.android.volley.toolbox.BasicNetwork.performRequest(:com.google.android.gms:163)
at iss.performRequest(:com.google.android.gms:64)
at com.android.volley.NetworkDispatcher.run(:com.google.android.gms:113)
W/LeaderboardAgent: {"errors":[{"domain":"global","reason":"PaginationTokenInvalid","message":"The passed token does not match the arguments of the request. Token: LeaderboardNextToken"}],"code":410}
我在 Unity3D 中针对此错误的代码是:
/// <summary>
/// Loads the scores using the provided parameters.
/// </summary>
/// <param name="leaderboardId">Leaderboard identifier.</param>
/// <param name="start">Start either top scores, or player centered.</param>
/// <param name="rowCount">Row count. the number of rows to return.</param>
/// <param name="collection">Collection. social or public</param>
/// <param name="timeSpan">Time span. daily, weekly, all-time</param>
/// <param name="callback">Callback to invoke when completed.</param>
PlayGamesPlatform.Instance.LoadScores(
"LeaderboardID", //The original ID obviously
LeaderboardStart.PlayerCentered,
10,
LeaderboardCollection.Public,
LeaderboardTimeSpan.AllTime,
(success) =>
{
leaderboardScoreData = success;
//Do Anything...
}
);
并在 LoadScores 之后的按钮...
/// <summary>
/// Loads more scores.
/// </summary>
/// <remarks>This is used to load the next "page" of scores. </remarks>
/// <param name="token">Token used to recording the loading.</param>
/// <param name="rowCount">Row count.</param>
/// <param name="callback">Callback invoked when complete.</param>
PlayGamesPlatform.Instance.LoadMoreScores(
leaderboardScoreData.NextPageToken,
10,
(success) =>
{
//Looking the returned object
Debug.Log("Load more scores info: " + success.ToString());
//Do Anything...
}
);
那个Debug.Logreturn:
I/Unity: Load more scores info: [LeaderboardScoreData: mId=LeaderboardID, mStatus=SuccessWithStale, mApproxCount=0, mTitle=]
下一页标记和上一页标记有一个正确的标记,但 Google 播放服务不能使用它,mTitle 在 LeaderboardScoreData 中无效。
谁能告诉我如何解决这个令牌错误?
我可以用其他方法得到其他分数吗?我不能再次使用 LoadScore,因为重新开始加载用户周围的用户,或者如果我能做到我不知道该怎么做。
对于未来的问题,最后的修复是:
在 https://console.developers.google.com/apis/dashboard 中激活 Google Play 服务,令牌将正常工作。