Reputation: 75
I can't figure out how to make the create an account function work in my application... I have my login system set up like so: https://i.sstatic.net/tAVXC.jpg The first set of strings are the passwords. The second set are the usernames. For someone to create an account that allows them to login, I have to make a string manually through the application. How can I make this function so it gets their input and places it as a string as long as the same username doesn't already exist? https://i.sstatic.net/3MJ9m.jpg
Upvotes: 0
Views: 1201
Reputation: 4884
If what you are asking is a persistent data, [[NSUserDefaults standardUserDefaults] setValue: forKey:]
will be the answer.
Once you save a data with NSUserDefaults, the data will be persistent. You can get the value with [[NSUserDefaults standardUserDefaults] valueForKey:]
Added
I misunderstood your question. In this case you should use local database as Chiques said.
Core Data will be the answer.
http://www.raywenderlich.com/934/core-data-tutorial-for-ios-getting-started
Upvotes: 0
Reputation: 13459
You need to create a local database, the proper way would be to use either sqllite or core data to create your structure, then simply add/remove users.
For an sql tutorial for ios follow this:
http://www.raywenderlich.com/913/sqlite-tutorial-for-ios-making-our-app
Or go to this site and check the section that says "Saving and Loading Data"
http://www.raywenderlich.com/tutorials
I personally prefer core data because its the most complete solution once you get used to setting it up.
Upvotes: 1