girish
girish

Reputation: 900

how to add attribute to NSManagedobject

Actually at first I created a NSManagedobject with name addtofav with attributes songid, songname, songlistid, imagepath, but now I want to add another attribute (i.e biography). Can you please guide me how to add an attribute to it?

Upvotes: 0

Views: 280

Answers (1)

user387184
user387184

Reputation: 11053

double-click on the *.xcdatamodel file, navigate to the object class you want to change and add/delete etc the attribute....

To create the new class file, mark the class you just changed, goto the project explorer on the left and ctrl-click on the "NSData Classes" Folder where all your data classes are, now select "New File" -> "Core Data" -> "NS ManagedObject subclass". It will ask to replace your previous file. Be careful when replacing, if you have changed/added any code to your data classes yourself. Use categories to add your methods, so replacing the data classes does not delete your user added code in the replaced files....

Upvotes: 1

Related Questions