I am using Core data without big problems, but I am not sure how can I keep data in unique, because I don't want to save same data into two objects.
How can I do?
How can I do?
My data is as belowWhen you create a database schema you normalized the data to prevent duplication and optimize.
Could you describe the data you're storing to help understand the problem better.
Can I design Entity to have unique key like in SQLite?So your question is how do I keep from having the same person in the database twice?
Before you Insert a new record you will need to search the database, i'm guessing looking for the name if that is unique, to see if it exists first if it does don't insert the new one.
What do you mean make own unique key?I'm don't recall if there is a way to do this in the model editor, and I don't have access to xcode at the moment.
But if not, you could always generate your own unique key.
This is what I need! I will try to do it.Each object in your Core data database already have a unique ID - the managed object ID. This will most likely meet your needs.
If you don't want to allow more than one 'Eric' in your entire database you must first search for any Eric's before creating a new one. In this case make sure to index the name table.
This is what I need! I will try to do it.
But I am still not sure why Apple only provide such way for unique attribute, I mean they can provide one method to do this so that no search need by user, can you explain that?