0

How to make two primary keys in CoreData , i have two rows , School Name and Student registration number , where Two rows can't be same with same Same school name and same registration number .

I am not able to find , how to make any primary key in coreData ?

Roshni
  • 61
  • 7
  • Don't think of Core Data as a database because it isn't. It's a persistence framework which can use SQLite, but that backing storage is not exclusive (it can store info in XML and even binary files). What you need to do is to manage your entities in your object graph. You should never care about the persistence details of Core Data. – Andy Ibanez Nov 28 '18 at 17:07
  • So i have to use SQLite Directly ?? how can i do this task .... @AndyIbanez – Roshni Nov 28 '18 at 17:46
  • Do you just need CoreData to enforce that the values are unique? https://stackoverflow.com/questions/21130427/how-to-add-unique-constraints-for-some-fields-in-core-data – Craig Siemens Nov 28 '18 at 18:01
  • Also, you don't have "rows" in Core Data. It sounds like you have (at least) 2 entities; `School` and `Student`. The student entity would have a reference to the school object – Paulw11 Nov 28 '18 at 19:54
  • https://stackoverflow.com/a/32814593/9250889 @AndyIbanez i think this will solve my problem right ? – Roshni Dec 06 '18 at 13:01

0 Answers0