문제

I have an entity attribute in which are stored both numbers and empty field. I need the sum and the average values of this attributes values but doing @"@sum.attributeName" or @"@avg.attributeName" I get

Terminating app due to uncaught exception 'NSDecimalNumberOverflowException', reason: 'NSDecimalNumber overflow exception'

Thank's

도움이 되었습니까?

해결책

I solved even if the Attributes are String Type as follows:

 NSArray *allValues = [array valueForKeyPath:@"@unionOfObjects.entityAttribute"];
NSMutableArray *allNumberValues = [[NSMutableArray alloc] init];


for (int i=0; i<valoriVotoEsame.count; i++) {

    if (            ![[allValues objectAtIndex:i] isEqual:@""])
    {
        [allNumberValues addObject:[allValues objectAtIndex:i]];


    }

}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top