Hello I am using core data in my application, and want to set ID attribute in every entity as autoincrement. Is it possible in core data? Or I have to manually insert the entry and manage the increment programatically??
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are thinking of the id for the primary keys then core data handles this for you. On each object there is an
objectIDproperty you can access to see it. When you create an object from the managed object context, core data assigns a temporary id. When you commit the changes from the managed object context, core data assigns a perminant id. I don’t think it would be a good idea to manually try and set this.Read this stackoverflow thread for more details.