问题
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