Reputation: 29
I think this is a pretty basic question, but I'm finding it hard to search for information because of the wording.
Basically, I'm working on an app that keeps track of my students. I want to assign each student a unique ID number. How can I create this variable so that I can reference and increment it when I want to add a new student? Obviously, I'll need to close and restart the app, and still keep track of the last ID number given.
Thanks. Sorry for silly question. ]
Upvotes: 0
Views: 97
Reputation: 1801
If your ID high value is all you want to store, Core Data would be overkill, and you might want to consider using NSUserDefaults. Not knowing more of your use case makes it difficult to know how appropriate this would be, but I mention it just in case you have a very lightweight need.
Upvotes: 1
Reputation: 6037
You should also look into CoreData, this is a good abstraction of a persistent store, for Objective-C object, it can be backed by a Database, XML, Binary data, iCloud.
Upvotes: 2
Reputation: 1786
store it the same place you store your student data. A database is the usual place these days.
Upvotes: 2