开发者

how to add attribute to NSManagedobject

开发者 https://www.devze.com 2023-02-28 18:24 出处:网络
Actually at first I created a NSManagedobject with name addtofav with attributes songid, s开发者_运维技巧ongname, songlistid, imagepath, but now I want to add another attribute (i.e biography). Can yo

Actually at first I created a NSManagedobject with name addtofav with attributes songid, s开发者_运维技巧ongname, 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?


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....

0

精彩评论

暂无评论...
验证码 换一张
取 消