保存特定于应用程序的数据,并在删除应用程序后保留

编程入门 行业动态 更新时间:2024-10-28 15:34:30
本文介绍了保存特定于应用程序的数据,并在删除应用程序后保留的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

有没有办法在应用程序卸载后保留一些数据,并且可以在应用程序再次安装后检索?

Is there a way to preserver some data even after app uninstalls and is retrievable after app gets installed again?

我找到了NSUserDefault,但我不确定。请告知。

I found NSUserDefault but I'm not sure. please advise.

let defaults = NSUserDefaults.standardUserDefaults() defaults.setObject("Coding Explorer", forKey: "userNameKey")

推荐答案

您需要使用Keychain,关于应用程序的敏感信息。

You need to use Keychain, to sore sensible information regarding app.

以下是如何实现这一目标的示例。

Here is an example how to achieve that.

KeyChain示例

UserDefaults将被删除,因此替代方案是Keychain。

UserDefaults will get delete when user uninstall app from device, so the alternative is Keychain.

更多推荐

保存特定于应用程序的数据,并在删除应用程序后保留

本文发布于:2023-11-14 02:02:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1585924.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   并在   数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!