有谁知道类 _NSObjectID_48_1 做什么?
好的,我正在这样做:我在两个日期之间获取对象 Schedule 的属性(描述、日期和个人数据),这也与对象 Operator 有关系,只有一种方式(Schedule -> Operator)。fetch 检索数据,但是当我想访问 Operator 的属性(如“name”)时,应用程序崩溃并告诉我“_NSObjectID_48_1”没有响应选择器。当然,我在获取过程中启用了这一行:
[request setRelationshipKeyPathsForPrefetching:[NSArray arrayWithObject:entityToPrefetch]];
这就是我设置要获取的属性的方式,而不是整个 Schedule 对象。同样在检索数据时,它被设置为“NSDictionaryResultType”,否则它会抱怨无法正确获取数据。
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Operator"
inManagedObjectContext:[AppDelegate managedObjectContext]];
NSDictionary *relationship = [entity relationshipsByName];
NSDictionary *entityProperties = [entity propertiesByName];
NSArray *properties = [[NSArray alloc] initWithObjects:[entityProperties objectForKey:@"description"],
[entityProperties objectForKey:@"date"],
[relationship objectForKey:@"personalData"],nil];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"date >= %@ && \
date <= %@",
[dateArray objectAtIndex:0],
[dateArray lastObject]];
schedArray = "执行 FETCH"
SLog(schedArray);
SLog([schedArray objectAtIndex:0]);
SLog([[schedArray objectAtIndex:0] objectForKey:@"employee"]);
VoicePickOperators *employee = (VoicePickOperators *)[[schedArray objectAtIndex:0] objectForKey:@"employee"];
SLog(employee);
SLog([employee name]); <<------ Problem, I am trying to access an attribute that should be there but instead is of the type __NSObjectID_48_1
SLog([employee description]);
有谁知道这是怎么回事??
谢谢!!