Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. for (NSEntityDescription *entityDescription in managedObjectModel)
  2. {
  3. // Attempt to pull out the TopObject relationship
  4. NSRelationshipDescription *topRelationshipDescription = entityDescription.relationshipsByName[@"top"];
  5.  
  6. // Test if the relationship points to the TopObject and if the entity is of the correct class
  7. if ([topRelationshipDescription.destinationEntity.name isEqualToString:@"TopObject"] &&
  8. [NSClassFromString(entityDescription.managedObjectClassName) isSubclassOfClass:[SubObject class]])
  9. {
  10. NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:entityDescription.name];
  11. fetchRequest.predicate = [NSPredicate predicateWithFormat:@"top = %@", topObject];
  12.  
  13. // fetch objects and add them to an array
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement