Core Data Transformable NSArray of IDs

旧城冷巷雨未停 提交于 2019-12-19 11:27:49

问题


I have an CoreData entity class X, which stores an NSArray of NSString IDs, inside a transformable attribute (lets say someIDs)...

Given an NSString ID, how can i find (using Predicate) all entities X, which contains the ID, in their someIDs attribute?

Note: i know about relationships (so no need to propose using a relationship) etc. but what to do in this case?


回答1:


You can't. A transformable attribute is store as a data blob in the SQLite store file (using NSCoding methods). The Core Data fetch request (which is translated to a SQLite query) has no access to the contents of the transformable attribute.

If you don't want to use a to-many relationship then you can only fetch all objects and filter the fetched NSArray.



来源:https://stackoverflow.com/questions/21697987/core-data-transformable-nsarray-of-ids

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