0
當我嘗試在iPhone Core-Data應用程序的列上獲取@sum時,發生異常。核心數據@sum聚合
我的兩個模型如下 -
任務模式:
@interface Task : NSManagedObject
{
}
@property (nonatomic, retain) NSString * taskName;
@property (nonatomic, retain) NSSet* completion;
@end
@interface Task (CoreDataGeneratedAccessors)
- (void)addCompletionObject:(NSManagedObject *)value;
- (void)removeCompletionObject:(NSManagedObject *)value;
- (void)addCompletion:(NSSet *)value;
- (void)removeCompletion:(NSSet *)value;
@end
完成方式:
@interface Completion : NSManagedObject
{
}
@property (nonatomic, retain) NSNumber * percentage;
@property (nonatomic, retain) NSDate * time;
@property (nonatomic, retain) Task * task;
@end
這裏是獲取:
NSFetchRequest *request = [[NSFetchRequest alloc] init];
request.entity = [NSEntityDescription entityForName:@"Task" inManagedObjectContext:context];
NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"taskName" ascending:YES];
request.sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSError *error;
NSArray *results = [context executeFetchRequest:request error:&error];
NSArray *parents = [results valueForKeyPath:@"taskName"];
NSArray *children = [results valueForKeyPath:@"[email protected]"];
NSLog(@"%@ %@", parents, children);
[request release];
[sortDescriptor release];
唯一的例外是拋出從底部開始的第四行。被拋出的異常是:
*** -[NSCFSet decimalValue]: unrecognized selector sent to instance 0x3b25a30
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFSet decimalValue]: unrecognized selector sent to instance 0x3b25a30'
我將非常感謝任何形式的幫助。 謝謝。
編輯:我在雪豹10.6.3和SDK 3.1.3上。