开发者

Can other programs read my NSUserDefaults settings?

On the iPhone, not including jail-br开发者_运维问答oken 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.


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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜