Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (NSEntityDescription *entityDescription in managedObjectModel)
- {
- // Attempt to pull out the TopObject relationship
- NSRelationshipDescription *topRelationshipDescription = entityDescription.relationshipsByName[@"top"];
- // Test if the relationship points to the TopObject and if the entity is of the correct class
- if ([topRelationshipDescription.destinationEntity.name isEqualToString:@"TopObject"] &&
- [NSClassFromString(entityDescription.managedObjectClassName) isSubclassOfClass:[SubObject class]])
- {
- NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:entityDescription.name];
- fetchRequest.predicate = [NSPredicate predicateWithFormat:@"top = %@", topObject];
- // fetch objects and add them to an array
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement