I have an NSArray called namesArray.
I need to store all the names existing in namesArray using coredata.
How do i achieve this ?
Does we need to create any database like 'names.sqlite' using sqlite manager?
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.
No you don’t need to create a
names.sqliteusing manager. You should go through some of the tutorial found on the net for example: Here or Here.You basically need to save in the datamodel in
valueForKeyformat.1. Creating an instance of your appdelegate .
2. Access your
Managed Object ContextandManaged Object3. Assuming you created a entity description with name contacts. With the count of number of items in your array, add each object for a column named
name(which i’m assuming you would have created).This is short example, but you should go through the tutorials and read apple’s documentation.
EDIT: As Ondra mentioned my earlier solution would have added only the last element. Use the following for adding: Adding NSMutableArray in CoreData Thanks Ondra Peterka