Tuesday, May 18, 2010

Edited value not of required format!

I'm using the xcode predicate editor to create a core data fetched property, and Apple's developer tools have proved inherently unusable yet again.

For a little back-story, I have some reference data, and my user can mark certain pieces of the reference data as favorites. I cannot store my favorites data in the same NSPersistentStore as my reference data. If I did, I couldn't updated my reference data file without migrating my favorites data out. Thus, I'm splitting my favorites data and reference data into separate NSPersistentStores. According to Apple's CoreData Programming Guide Cross-Store Relationships section I cannot have a relationship that spans two persistent stores. I need to use a fetched property.

Now you're caught up. When you create a fetched property, you have to create a predicate to use to find the entity the fetched property represents. This seems straightforward enough, but I kept getting this cryptic message "Edited value not of required format!" After some googling, I found the answer.

Basically, the editor defaults to expecting a constant value rather than a variable value. To switch to a variable, right-click in the empty space between the text field and the plus/minus buttons. Of course, a drop-down menu would be much better, but I never accused apple of having good tools.