我正在使用下面的代码来获取我的核心数据属性之一中的值,但我不知道是否可以提取它们并将它们求和,我想知道是否有人可以帮助我:
AppDelegate *appDelegate =[[UIApplication sharedApplication] delegate];
self.contextTotal=[appDelegate managedObjectContext];
NSEntityDescription *entity= [NSEntityDescription entityForName:@"CellSave" inManagedObjectContext:contextTotal];
NSFetchRequest *request= [[NSFetchRequest alloc] init];
[request setEntity:entity];
[request setResultType:NSDictionaryResultType];
[request setReturnsDistinctResults:YES];
[request setPropertiesToFetch:[NSArray arrayWithObject:@"smtrCbrData"]];
NSArray *objects= [contextTotal executeFetchRequest:request error:nil];
NSLog (@"results: %@",objects);
结果是:
Structure[1595:11603] results: (
{
smtrCbrData = "\U20ac 770.00";
},
{
smtrCbrData = "\U20ac 3,080.00";
}
是否有可能得到数字并将它们相加?我该怎么做?
谢谢