I am very new to the Core Data programming. I have a question to which I hope to get some clarification.
Supposing I have an NSManagedObject called Company, with the following attributes:
- companyName
- companyEmail
- companyPhoneNo
- companyUserName
- companyPassword
In this object the companyName attribute is indexed.
So, my question is, how can I make sure that there will be only entry with same companyName, companyEmail, companyPhoneNo, companyUserName and companyPassword?
Do I need to make a request to check if there are any records with the same attribute values or is a simple check with the object id sufficient?
Thanks.
Here’s an example may be helps:
Tip:
countForFetchRequest:error:does not fetch entity actually, it just returns a number of entities that match thepredicateyou set before.