我正在使用 foliowin 函数来获取应用程序中的所有记录
-(NSArray*)recordsInTable:(NSString*)tableName andManageObjectContext:(NSManagedObjectContext *)manageObjContext
{
NSError *error=nil;
// **** log objects currently in database ****
// create fetch object, this object fetch's the objects out of the database
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName: tableName inManagedObjectContext:manageObjContext];
[fetchRequest setEntity:entity];
NSArray *fetchedObjects = [manageObjContext executeFetchRequest:fetchRequest error:&error];
return fetchedObjects;
}
并使用以下代码获取记录
NSArray *records=[dbAccessObj recordsInTable:@"Details" andManageObjectContext:managedObjectContext];
NSLog(@"records %@",records);
我收到这样的日志
**records (
"<Details: 0x76374b0> (entity: Details; id: 0x7636730 <x-coredata://CDEF0797-F141-47A7-902D-9689DCD90B83/Details/p1> ; data: <fault>)",
"<Details: 0x7637770> (entity: Details; id: 0x7636740 <x-coredata://CDEF0797-F141-47A7-902D-9689DCD90B83/Details/p2> ; data: <fault>)",
"<Details: 0x7637870> (entity: Details; id: 0x7636750 <x-coredata://CDEF0797-F141-47A7-902D-9689DCD90B83/Details/p3> ; data: <fault>)"
)**
但我想显示所有详细信息的日志,显示如下所示的记录。我犯了什么错误?
**{
age = 11;
fName = "firstName";
lName = "lastname";
sId = 4;
})**