ios – 通过GameKit将游戏数据保存到iCloud中
2019年06月19日
作者:佚名
我正在尝试通过下一个代码将游戏数据保存到iCloud:
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer]; [localPlayer saveGameData:[NSData dataWithBytes:rawData->data() length:rawData->size()] withName:[NSString stringWithUTF8String:fileName.c_str()] completionHandler:^(GKSavedGame *savedGame,NSError *error) { if (error == nil) { DebugLog(@"Snapshot successfully saved"); } else { DebugLog(@"saveSnapshot error: %@",error.description); } }];
但是收到错误消息:由于您未登录iCloud,因此无法完成请求的操作
我试过在iOS模拟器和设备上做这个但是没有成功.
并尝试使用测试苹果ID,开发苹果ID,新苹果ID,但也没有成功.
用户在iOS设置中登录iCloud并登录到Game Center.
有什么建议?
解决方法
我有类似的问题.在我的设备设置上使用我的iCloud帐户登录后,仍然显示完全相同的错误,并且只有在我为帐户启用iCloud Drive时才会停止,否则它将永远无法运行.
因此,看起来用户必须使用iCloud Drive,否则GKSavedGame将无法运行.据我所知,Apple文档从未提及过.
以上是来客网为你收集整理的ios – 通过GameKit将游戏数据保存到iCloud中全部内容,希望文章能够帮你解决ios – 通过GameKit将游戏数据保存到iCloud中所遇到的程序开发问题。
如果觉得来客网网站内容还不错,欢迎将来客网网站推荐给程序员好友。