ios-queryable
ios-queryable copied to clipboard
Unrecognized Selector count sent to an NSNumber
While trying to query an average value during an NSManagedObject's awakeFromFetch and awakeFromInsert, I'm getting this error:
2015-08-10 22:07:10.077 PropertyHunter[29805:971191] -[NSDecimalNumber count]: unrecognized selector sent to instance 0x608000431260
The line of code:
[[[sharedContext ofType:@"Store"] where:@"location.zipcode = %@", self.zipcode] average:@"visits"];
I'm using this in a Mac OS X app. Any idea why this happens?
Hey, thanks for the bug report!
I was able to reproduce this with an OS X app. It looks like OS X apps use NSXMLStoreType for Core Data, and apparently, that causes some different behaviors when using NSExpressions. Seems like the bug occurs when using raw Core Data, even without involving ios-queryable.
Switching to NSSQLiteStoreType fixed the problem in my test app, but I'll try to find a proper solution that doesn't require doing that.
Thanks for looking into it!
— Sent from Mailbox
On Mon, Aug 17, 2015 at 9:21 AM, Marty Dill [email protected] wrote:
Hey, thanks for the bug report! I was able to reproduce this with an OS X app. It looks like OS X apps use NSXMLStoreType for Core Data, and apparently, that causes some different behaviors when using NSExpressions. Seems like the bug occurs when using raw Core Data, even without involving ios-queryable.
Switching to NSSQLiteStoreType fixed the problem in my test app, but I'll try to find a proper solution that doesn't require doing that.
Reply to this email directly or view it on GitHub: https://github.com/martydill/ios-queryable/issues/6#issuecomment-131672336