We Recommend

Programming in Objective-C Programming in Objective-C
Programming in Objective-C is a concise, carefully written tutorial on the basics of Objective-C and object-oriented programming. The book makes no assumption about prior experience with object-oriented programming languages or with the C language (upon which Objective-C is based). And because of this, both novice and experienced programmers alike can use this book to quickly and effectively learn the fundamentals of Objective-C.


Posted By

buscarini on 12/31/69


Tagged

fetch textmate cocoa coredata mac


Versions (?)


Who likes this?

3 people have marked this snippet as a favorite

daniel
xaviaracil
zingo


Pedir todas las entidades de cierto tipo


Published in: Objective C 


  1. NSManagedObjectContext *moc = [self managedObjectContext];
  2. NSEntityDescription *entityDescription = [NSEntityDescription
  3. entityForName:@\"GraphicalEntity\" inManagedObjectContext:moc];
  4. NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
  5. [request setEntity:entityDescription];
  6.  
  7. NSError *error = nil;
  8. NSArray *array = [moc executeFetchRequest:request error:&error];
  9. if (array == nil)
  10. {
  11. // TODO: Deal with error...
  12. return nil;
  13. }
  14. else return array;
  15.  
  16. }

Report this snippet 

You need to login to post a comment.