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

前端 未结 5 1911
情深已故
情深已故 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:24

    Anything stored in NSUserDefaults can be (relatively) easily opened and read, whether on the device or in a (non-encrypted) backup to iCloud or to a sync'd Mac.

    Keychain, on the other hand, is meant for stuff like certificates and passwords. I've linked an article titled "How Not To Store Passwords in iOS" which gives a bit more useful detail, as well.

提交回复
热议问题