Core Data saving problem: can't update transformable attribute (NSArray)

倖福魔咒の 提交于 2019-12-03 16:11:17

Just found the problem. From Model Object Implementation Guide:

If there are mutable and immutable versions of a class you use to represent a property—such as NSArray and NSMutableArray—you should typically declare the return value of the get accessor as an immutable object even if internally the model uses a mutable object.

And my products array was actually a NSMutableArray instance. I solved it by copying products (so I converted mutable array to immutable array). Now it works. :) And I didn't need to start the bounty...

Indeed, you've just found the problem. Sorry I just read your problem, but CoreData has several problems during saving.

Each attribute in a CoreData Entity must be immutable objects.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!