Iam creating a dummy app for the real project, in which I have Login page. Now I have some usernames and passwords which when entered in the textfields and login button pressed should take me to the next view. Is there any way to store these usernames and passwords? thanks
Share
Go to this Link : iOS: How to store username/password within an app?
OR
You should always use Keychain to store usernames and passwords, and since it’s stored securely and only accessible to your app, there is no need to delete it when app quits (if that was your concern).
Apple provides sample code that stores, reads and deletes keychain items and here is how to use the keychain wrapper class from that sample which greatly simplifies using Keychain.
Put Security.framework (in Xcode 3 right-click on frameworks folder and add existing framework. In Xcode 4 select your project, then select target, go to Build Phases tab and click + under Link Binary With Files) and KeychainItemWrapper .h & .m files into your project, #import the .h file wherever you need to use keychain and then create an instance of this class:
(YourAppLogin can be anything you chose to call your Keychain item and you can have multiple items if required)
Then you can set the username and password using:
Get them using:
Or delete them using: