Can other programs read my NSUserDefaults settings?

自古美人都是妖i 提交于 2019-12-08 15:45:11

问题


On the iPhone, not including jail-broken phones, can other apps read the values you've set using NSUserDefaults? I'm considering saving the customer's userid/password for our service and want to make sure it is secure.


回答1:


No, other applications cannot see your data. That said, you should probably consider using the keychain on the iPhone to store sensitive data like usernames and passwords.




回答2:


No, applications are sandboxed. This includes their own directory for preferences and user data.

see: http://developer.apple.com/iPhone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7-SW44




回答3:


First of all, you should be saving userid/password in the keychain, not the user defaults.

Secondly, yes, other applications can read the NSUserDefaults. The defaults are unix style user defaults not application defaults. Under the old NextStep OS, an individual users defaults would follow them from networked machine to networked machine. The idea is that users have preferences for things like default fonts that all applications should use.

The iPhone inherited that by being a slimmed down version of MacOS X. I am not sure how thorough the sandboxing on iPhone apps is that regard. It might be possible to worm a way through the system if you knew the proper keys for domains and values.

Certainly, Apple strongly discourages keeping any sensitive information in the user defaults.



来源:https://stackoverflow.com/questions/1868788/can-other-programs-read-my-nsuserdefaults-settings

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