Open donnerluetjen opened 8 years ago
Is this a bug or am I doing it wrong? I have an entity DLAccountItem with an attribute amount of type Decimal. Trying to use this aggregate function:
DLAccountItem
amount
Decimal
sum = [DLAccountItem MR_aggregateOperation:@"sum:" onAttribute:@"amount" withPredicate:nil inContext:moc];
the following error is thrown:
-[NSDecimalNumber count]: unrecognized selector sent to instance 0x608000223600 2016-01-12 23:16:26.373 TherAccount[72461:28525114] An uncaught exception was raised 2016-01-12 23:16:26.373 TherAccount[72461:28525114] -[NSDecimalNumber count]: unrecognized selector sent to instance 0x608000223600 2016-01-12 23:16:26.373 TherAccount[72461:28525114] ( 0 CoreFoundation 0x00007fff8b132ae2 __exceptionPreprocess + 178 1 libobjc.A.dylib 0x00007fff949fff7e objc_exception_throw + 48 2 CoreFoundation 0x00007fff8b135b9d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x00007fff8b06e601 ___forwarding___ + 1009 4 CoreFoundation 0x00007fff8b06e188 _CF_forwarding_prep_0 + 120 5 Foundation 0x00007fff98448ff6 +[_NSPredicateUtilities _getCommonTypeFor:] + 76 6 Foundation 0x00007fff9844930a +[_NSPredicateUtilities sum:] + 144 7 Foundation 0x00007fff982aecff -[NSFunctionExpression expressionValueWithObject:context:] + 1094 8 CoreData 0x00007fff8ec58f8a -[NSMappedObjectStore executeFetchRequest:withContext:] + 2122 9 CoreData 0x00007fff8ecb3288 __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 4120 10 CoreData 0x00007fff8ecbdb63 gutsOfBlockToNSPersistentStoreCoordinatorPerform + 179 11 libdispatch.dylib 0x00007fff95b0933f _dispatch_client_callout + 8 12 libdispatch.dylib 0x00007fff95b0a926 _dispatch_barrier_sync_f_invoke + 74 13 CoreData 0x00007fff8ecac662 _perform + 194 14 CoreData 0x00007fff8ebf05c5 -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 533 15 CoreData 0x00007fff8ebeed4a -[NSManagedObjectContext executeFetchRequest:error:] + 586 16 CoreData 0x00007fff8ec3845b -[NSManagedObjectContext(_NestedContextSupport) _parentObjectsForFetchRequest:inContext:error:] + 427 17 CoreData 0x00007fff8ec70834 __82-[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:]_block_invoke + 388 18 CoreData 0x00007fff8ec38274 internalBlockToNSManagedObjectContextPerform + 68 19 libdispatch.dylib 0x00007fff95b0933f _dispatch_client_callout + 8 20 libdispatch.dylib 0x00007fff95b0a926 _dispatch_barrier_sync_f_invoke + 74 21 CoreData 0x00007fff8ec381ac _perform + 220 22 CoreData 0x00007fff8ec37fcf -[NSManagedObjectContext(_NestedContextSupport) executeRequest:withContext:error:] + 351 23 CoreData 0x00007fff8ebeed4a -[NSManagedObjectContext executeFetchRequest:error:] + 586 24 TherAccount 0x000000010002e072 __67+[NSManagedObject(MagicalRecord) MR_executeFetchRequest:inContext:]_block_invoke + 66 25 CoreData 0x00007fff8ec37ce4 developerSubmittedBlockToNSManagedObjectContextPerform + 196 26 CoreData 0x00007fff8ec37bae -[NSManagedObjectContext performBlockAndWait:] + 206 27 TherAccount 0x000000010002debf +[NSManagedObject(MagicalRecord) MR_executeFetchRequest:inContext:] + 303 28 TherAccount 0x000000010002e34a +[NSManagedObject(MagicalRecord) MR_executeFetchRequestAndReturnFirstObject:inContext:] + 122 29 TherAccount 0x0000000100027f43 +[NSManagedObject(MagicalAggregation) MR_aggregateOperation:onAttribute:withPredicate:inContext:] + 803 30 TherAccount 0x0000000100005304 -[DLAccountant balance] + 884
@donnerluetjen I'm also seeing issues when using the Decimal type. Did you figure this out?
Is this a bug or am I doing it wrong? I have an entity
DLAccountItem
with an attributeamount
of typeDecimal
. Trying to use this aggregate function:the following error is thrown: