使用 NSUserDefault 保存游戏进度:好主意还是坏主意?
我正在开发一款游戏,用户所做的所有进度都将保存在 NSUserDefaults 中。这是一个好主意还是坏主意???
保存下来的游戏输掉的几率有多大?有更好的方法吗?
当用户同步设备时,iTunes会备份NSUserDefaults吗?那么,如果用户更换设备,他不会丢失进度,他只需将设备与 iTunes 同步即可?安全性如何?
GameCenter 成就也将通过 NSUserDefaults 保存,以防用户当时没有互联网连接。
好吧,我只是想知道你的意见/经验。所有代码都运行完美,但我担心玩家可能会因某种原因失去进度。
如果有人想了解有关代码的更多详细信息,请随时询问,我可以将其发布在这里。
谢谢!
I'm working on a game and all progress the user makes will be saved with NSUserDefaults. Is it a good or bad idea???
What are the chances of losing the game saved? Is there a better way to do this?
When the user syncs the device, iTunes will backup NSUserDefaults? So in case the user changes his device he will not lose the progress, he just has to sync the device with iTunes? How safe is it?
GameCenter achievements will be saved with NSUserDefaults as well, in case the user doesn't have an internet connection at the time.
Well, I just wanna know your opinion/experience. All code is working flawless, but I'm afraid the player might lose his progress for some reason.
If anyone wants more details on the code fell free to ask, I can post it here.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在我看来,NSUserDefaults 是完全安全的。即使应用程序版本更新后,内容也会得到维护。
In my opinion, NSUserDefaults is perfectly safe. The contents are even maintained after a version update of the app.
如果用户同步应用程序,
NSUserDefaults
会同步到 iTunes。只要用户不删除游戏,数据就是安全的。如果您需要在用户删除游戏后保留数据,您可以考虑将数据保存在其他地方(例如,Dropbox、自己的服务器等)
NSUserDefaults
are synced to iTunes if the user syncs the app. The data is safe as long as the user does not delete the game.If you need to preserve the data even after the user deletes the game, you may consider saving the data somewhere else (say, Dropbox, own server, etc.)