macOS swift - save data to local storage - best practices

女生的网名这么多〃 提交于 2021-02-07 09:11:01

问题


I'm a newbie in macOS development. I have an application where I need to save a string (for example a token) to some local storage, and after closing and opening app I want to retrieve this string back.

Is it somehow possible that only my app would be able to retrieve this string?

Is it better to write it to the txt file or there are some other possibilities?

Thank you.


回答1:


It depends on the security of the data.

  • If security matters save the string in the keychain.
  • If security does not matter save the string in UserDefaults


来源:https://stackoverflow.com/questions/49177642/macos-swift-save-data-to-local-storage-best-practices

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!