How do I generate code (or find the code generated

2019-07-09 01:47发布

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条回答
走好不送
2楼-- · 2019-07-09 02:15

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.

查看更多
登录 后发表回答