What is the best way to maintain the login credentials in iOS?

后端 未结 3 1150
傲寒
傲寒 2021-02-03 11:32

I need to maintain my log-in credential for throughout the app so, I have 3 options to maintain my log-in credentials...

1 key chain
2 NSUserDefaults
3 plist
         


        
3条回答
  •  北海茫月
    2021-02-03 12:17

    I'll suggest keychain for storing the login credentials due to the security feature it provides. The keychain services on iOS provide a means to securely store content such as passwords, keys, certificates, etc.

    Sensitive data like passwords and keys should be stored in the Keychain. Apple's Keychain Services Programming Guide states that

    "A keychain is an encrypted container that holds passwords for multiple applications and secure services. Keychains are secure storage containers, which means that when the keychain is locked, no one can access its protected contents".

    Here is two nice tutorial for you.

    1. How Not to Store Passwords in iOS
    2. Using Keychain to Store Username and Password
    3. How to secure user data

提交回复
热议问题