NSUserDefaults or keychain is better to save username and password in iPhone app

前端 未结 5 1885
情深已故
情深已故 2020-12-02 01:40

In my iphone app there is some confidential data like username, password and some urls to a webservice. Which one is better NSUserdefaults or keychain. Somebody says NSUser

5条回答
  •  失恋的感觉
    2020-12-02 02:05

    I would recommend you to use Keychains. Using Keychain, you can store your password in encrypted form. Take a look at Apple's GenericKeychain sample.

    NSUserDefaults is a little less secure when compared with Keychain. In NSUserDefaults data can accessed easily if the specific key is known. This is not the case in Keychain.

    You can also convert NSUserDefaults to Keychains. Take a look here.

提交回复
热议问题