I have an entity with a "date" property, and derived properties "year" and 
"month" (by having year/month methods in my NSManagedObject subclass). In a 
couple of different places, I fetch the entries from a particular year or 
month- the fetch requests's predicate says "year == 2009". 

This works fine except in a document that has been saved and reopened: the 
first time I make a change to an object, and then try to fetch a list of 
objects by year, an exception is thrown saying "keypath year not found". What 
confuses me is that between reopening the document, and making a change, I can 
make (as far as I can tell) the same request to filter by year (or month) 
without problems. It doesn't matter which property I change - date or anything 
else.

So I have two questions:
1. Why would this happen?
2. What's a good, simple way to write a unit test that simulates closing an 
reopening a Core Data document? I want to avoid actual file operations for the 
sake of simplicity, but NSPersistentDocument does not implement the 
dataOfType:error: method.

-- 
David Catmull
uncom...@uncommonplace.com
http://www.uncommonplace.com/

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to