开发者

Giving stored information a unique identifier

开发者 https://www.devze.com 2023-03-15 22:43 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号