ios - 如何更新 GKSavedGame 的描述?
问题描述
我正在尝试在我的 iOS 游戏中实现 GameKit (Game-Center) 的 Saved Games 功能。检查 GKSavedGame 类会发现有一个描述字段未记录在案。
[[GKLocalPlayer localPlayer] fetchSavedGamesWithCompletionHandler:^(NSArray<GKSavedGame *> * _Nullable savedGames, NSError * _Nullable error) {
if(error == nil)
{
for(GKSavedGame *savedGame in savedGames) {
NSLog(@"Name: %@", savedGame.name);
NSLog(@"Description: %@", savedGame.description);
NSLog(@"Unix Timestamp: %@", [NSString stringWithFormat: @"%f", savedGame.modificationDate.timeIntervalSince1970]);
}
}
else
{
NSLog(@"Failed to download saved games metadata: %@", error.description);
}
downloadSavedGamesMetadataWait = false;
}];
我认为这就是它的完成方式。
现在我正在寻找保存游戏数据的可能性,我在 localPlayer 对象上找到了 saveGameData 函数,但它不允许向它传递新的描述。
我怎样才能更新描述呢?
解决方案
答案是不可能的。Apple 将描述字段用于保存时生成的某些元数据,例如人类可读形式的时间戳。他们不支持为保存的游戏提供自己的描述。
推荐阅读
- asp.net-core - ASP.NET Core 将 Web 应用程序部署到 aws ubuntu 服务器 18。除了没有 css、js、jquery 或引导程序之外,一切正常
- asp.net-mvc - 调试模式下的 ASP.NET 针对本地 SQL Server 2019 数据库获取随机超时
- python - 如何在python中更改按钮颜色
- python - 如何根据 Python Pandas 中的其他列在 DataFrame 中创建新列?
- python-3.x - Jupyter Notebook 如何为 datepicker 分配默认值并对所选日期内的时间进行排序?
- python - 通过脚本或终端运行时的scrapy模块路径差异
- php - Laravel 8重定向回来,消息在刀片模板中不起作用
- wordpress - 检索并放置在表单字段中的自定义维度
- wso2 - 为什么我的 WSO2 APIM APIKeyValidator 以 Erro 响应?
- android - Google ArCore Sceenform - 在运行时加载时使用 glTF 或 GLB 的 ModelRenderable 会导致应用程序崩溃