-[NSCFNumber count]: unrecognized selector
问题 I've got some Core Data code that follows Apple's sample code precisely (the Fetching Attribute Values that Satisfy a Given Function example). I'm using it to get the max value of a field, so I can then increment it when I insert the next object of that entity type. I couldn't get the code to work at all, until I switched my Store Type from NSXMLStoreType to NSSQLiteStoreType , then all of a sudden everything seemed to be working. However, that's not the case. I noticed that it would always