开发者

NSFetchedResultsController depth of fetchedObjects

开发者 https://www.devze.com 2023-02-04 01:26 出处:网络
I have a strange problem here and I want to know, if its related to the lazy loading function. I do a fetch on my categories. Imagine they have subcategories and these have subsubcategories also. the

I have a strange problem here and I want to know, if its related to the lazy loading function. I do a fetch on my categories. Imagine they have subcategories and these have subsubcategories also. the question right now is: Is the fetchedObjects-Array also collecting the data of the relationship from the subcategories. In short, is it possible to access data something like that: category.subcategory.subsubcategory.name or do i need to make a new fetch on the su开发者_运维技巧bcategories first to get access like with subcategory.subsubcategory.name?

I dont get the whole set of the subsubcategories while I am doing it with one fetch. i only get everytime 1 entry instead of 20 or whatever the count should be.

Does anyone have an idea how coredata is handling this? And is it the common way to make a fetchrequest on every new table? Wouldn't it be quite inefficient?

thanks for any help


Use setIncludesSubentities on the NSFetchRequest.

you can also use setPropertiesToFetch to go deep like category.subcategory.subsubcategory.name

propertiesToFetch I believe only works on attributes and to-one relationships however...

0

精彩评论

暂无评论...
验证码 换一张
取 消