I saved a NSData (of UIImage) in an attribute of CoreData. There are still some other attributes under the same entity. How can I remove just the NSData stored, but not r开发者_运维百科emoving the whole NSManagedObject? I tried overwriting it to nil, but the size of DB did not change at all, which means the NSData is not removed?
It means the amount of space used to store some value for that attribute is still there, but it does not mean that you did not successfully obliterate the value. Did you use [managedObjectContext save:&error]
after writing to the value? If so and it reported no error then the value is gone.
(Does the size of the store really increase when you set an attribute? I expect it would when you add an entity but not just for setting an attribute.)
if you are using tableview to display your CoreData and edit current indexPath in an new VC, try YOURCOREDATA.setNilValueForKey("YOUR IMAGE KEY"). i'm just a newbee of iOS dev but it works fine to me at least.
精彩评论