SHARE
TWEET

Untitled

a guest Feb 20th, 2019 84 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -(NSArray*)recordsInTable:(NSString*)tableName andManageObjectContext:(NSManagedObjectContext *)manageObjContext
  2. {
  3.     NSError *error=nil;
  4.     // **** log objects currently in database ****
  5.     // create fetch object, this object fetch's the objects out of the database
  6.     NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
  7.     NSEntityDescription *entity = [NSEntityDescription entityForName: tableName inManagedObjectContext:manageObjContext];
  8.     [fetchRequest setEntity:entity];
  9.     NSArray *fetchedObjects = [manageObjContext executeFetchRequest:fetchRequest error:&error];
  10.     return  fetchedObjects;
  11. }
  12.    
  13. NSArray *records=[dbAccessObj recordsInTable:@"Details" andManageObjectContext:managedObjectContext];
  14.     NSLog(@"records %@",records);
  15.    
  16. **records (
  17.     "<Details: 0x76374b0> (entity: Details; id: 0x7636730 <x-coredata://CDEF0797-F141-47A7-902D-9689DCD90B83/Details/p1> ; data: <fault>)",
  18.     "<Details: 0x7637770> (entity: Details; id: 0x7636740 <x-coredata://CDEF0797-F141-47A7-902D-9689DCD90B83/Details/p2> ; data: <fault>)",
  19.     "<Details: 0x7637870> (entity: Details; id: 0x7636750 <x-coredata://CDEF0797-F141-47A7-902D-9689DCD90B83/Details/p3> ; data: <fault>)"
  20. )**
  21.    
  22. **{
  23.     age = 11;
  24.     fName = "firstName";
  25.     lName = "lastname";
  26.     sId = 4;
  27. })**
  28.    
  29. NSArray *allAges = [records valueForKey:@"age"];
  30. NSLog(@"records %@",records);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top