如何在不丢失 NSUserDefaults 的情况下重新安装应用程序? [英] How to reinstall an app without losing NSUserDefaults?

查看:64
本文介绍了如何在不丢失 NSUserDefaults 的情况下重新安装应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 NSUserDefaults 保存游戏进度的 iOS 游戏.在用户上次更新后遇到问题,该应用程序不再在此设备上运行.该应用没有任何问题,但由于某种原因在下载该应用时出现错误,不太确定发生了什么.

I have an iOS game that saves game progress using NSUserDefaults. After the last update a user had a problem, the app was not working anymore on this device. The app doesn't have any problem, but for some reason an error occurred while downloading the app, not quite sure what happened.

重点是,必须删除并重新安装该应用程序.这可以在不删除 NSUserDefaults 的情况下完成吗?

The point is, the app must be deleted and reinstalled. Can this be done without erasing NSUserDefaults?

我在删除应用程序后尝试在此处与 iTunes 同步,甚至通过 iTunes 重新安装它,但我无法在我的测试设备上恢复之前保存的游戏.

I tried syncing with iTunes here after deleting the app, even installing it again through iTunes but I was unable to restore the previous saved game on my test devices.

我想重新安装应用程序的唯一方法是通过应用程序更新.当它出来时,他会更新并且不会丢失任何数据.这样对吗?或者有没有其他方法可以做到这一点?

I guess the only way to reinstall the app is through an app update. When it comes out he will update and will not lose any data. Is this correct? Or is there any other way to do this?

我正在努力在下次更新时实现云同步,所以这个问题应该不会再成为问题:).但是现在,我对这个用户做了什么吗?

I'm working to implement cloud syncing on the next update, so this problem should not be an issue again :). But right now, is there anything and I do to this user?

推荐答案

从 iTunes Backupd 恢复设备可能会重新安装应用程序并保留 NSUserDefaults,假设它们包含在备份中.

Restoring the device from an iTunes Backupd probably reinstalls the app and also keeps the NSUserDefaults, assuming they are included in the backup.

但是,这需要由用户完成...从长远来看,一些同步选项是更好的解决方案.

However, this needs to be done by the user ... Some syncing option is the better solution on the long way.

这篇关于如何在不丢失 NSUserDefaults 的情况下重新安装应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆