Giving stored information a unique identifier
Let me just give you a quick rundown of my program for the end user: the user adds a credit card to the program, the program authorizes the card by sending information to the server, program displays "Approved" or "Denied" and the card is saved if approved.
Each card needs to have a unique identifier for other parts of the program to work, just like an 开发者_Go百科array location +1 (i.e. first card = 1, second card = 2, etc.) but I'm unsure of how to implement this in Core Data unless it's already done somewhere and I just misunderstood the docs. So, how do I do this?
CoreData already provides this, assuming you store the Credit Card as it's own entity (makes it easy to refer to it from other objects. You can case you CreditCard managed object as an NSManagedObjectID, and presto, you have a thread safe identifier which represents that unique entity in it's data store.
精彩评论