How do I generate code (or find the code generated) for fetch requests I created graphically using the data model editor in Xcode 4.x?

倖福魔咒の 提交于 2020-01-05 03:16:15

问题


I can see where the code goes for the Entities, as NSManagedObject specialized classes, that was very straightforward.

Bu t I do not see generated code or an option to generate code for visually designed fetch requests.


回答1:


There is no actual "code" but just serialized NSFetchRequest objects in the data model file. You can get the NSFetchRequest objects themselves which you can query for their predicates and the like.

For fetch templates use -[NSMangedObjectModel fetchRequestTemplateForName:] and related methods.

If it's a fetch property you want, you get the entity description from the managed object model and then ask the entity for its fetched properties. Then use -[ NSFetchedPropertyDescrition fetchRequest] to get the actual NSFetchRequest object.



来源:https://stackoverflow.com/questions/6430477/how-do-i-generate-code-or-find-the-code-generated-for-fetch-requests-i-created

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