ios - NSPredicate that filters out subclass results -


i have 2 classes, company , mycompany. mycompany subclass of company, , company subclass of nsmanagedobject. trying write predicate nsfetchrequest return results of class company, filter out mycompany objects.

i have tried following (suggested here https://stackoverflow.com/a/8065935/472344):

nspredicate *predicate = [nspredicate predicatewithformat:@"class != %@",nsstringfromclass([mycompany class])]; 

but error:

'keypath class not found in entity <nssqlentity ckcompany id=1>' 

i tried (suggested here https://stackoverflow.com/a/11693983/472344, know want not self iskindofclass, testing exact same command given in answer):

nspredicate *predicate = [nspredicate predicatewithformat:@"self iskindofclass: %@", [mycompany class]; 

and got following error:

'unknown/unsupported comparison predicate operator type' 

how can write predicate achieve want? supporting ios 5 , above.

you can set

[fetchrequest setincludessubentities:no]; 

so fetch request returns objects of entity type of request, , not include subentities.

it (as far know) not possible refer objects class or entity name in predicate if predicate used in core data fetch request.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -