iOS: How to store username/password within an app?

前端 未结 14 1355
独厮守ぢ
独厮守ぢ 2020-11-22 06:18

I have a login-screen in my iOS app. The username and password will be saved in the NSUserDefaults and be loaded into the login-screen again when you enter the

14条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-22 06:35

    To update this question:

    For those using Swift checkout this drag and drop swift implementation by Mihai Costea supporting access groups:

    https://github.com/macostea/KeychainItemWrapper.swift/blob/master/KeychainItemWrapper.swift

    Before using the keychain: consider twice before storing passwords. In many cases storing an authentication token (such as a persistence session id) and the email or account name might be enough. You can easily invalidate authentication tokens to block unauthorized access, requiring the user to login again on the compromised device but not requiring reset password and having to login again on all devices (we are not only using Apple are we?).

提交回复
热议问题