View Full Version : ch11. Cocoa Programming - Core Data

Jul 1, 2008, 03:09 PM
Hi Guys and Gals,

I'm running thru CarLot - Basic Core Data example in Ch11 (3rd Edition btw). The application works allowing me to load and save a dataset. There is, however, one issue. The 2nd column of the tableview "Price" refuses to allow me to enter a value without err'ing with "Formatting Error". The nib in interface builder has a Number Formatter set to style Currency, the underlying Entity table has an attribute named "price" who's type is Decimal.

All as per instructions in the book (as far as I can see) - yet I still run-time issues.

Any help would be appreciated.


Jul 1, 2008, 06:35 PM
Hmm, I've never used the decimal type for entities. Try with a double and see if that works.

Jul 2, 2008, 03:07 AM
cheers willdo

Jul 2, 2008, 03:18 AM
changing price to a double makes no difference ...

next suggestions anyone ?
I'm more interested in how you would debug this issue when the issue is somewhere in CoreData.

Jul 2, 2008, 10:48 AM
Can you attach the source code and project?

Jul 2, 2008, 11:44 PM
I don't have it in front of me but I ran into the same error I think when I ran it. I had chosen the wrong formatting option (10.4 vs 10.0 I think). For some reason the 10.4 formatting gives me problems.

Jul 3, 2008, 12:12 AM
Same problem here.

I fixed it the same way perrien did. I changed the formatting option to 10.0, clicked on the currency option and it worked. If you want to use 10.4 formatting, another option, which is a bit of a copout, is to change the style to decimal. That works, but it's not correct in the spirit of the exercise.

Jul 3, 2008, 06:29 AM
Thanks guys.

I'm definitely using 10.4+ formatting so it sounds like thats the problem ...
weird huh ...

I'll try both options tonight.

Cheers again I appreciate it.

Jul 3, 2008, 06:35 AM
^^ Are you on 10.4? 10.4+ formatting doesn't work in that case.

Jul 3, 2008, 06:47 AM

Both options worked (although I had to modify the numeric format for positive numbers to make it "emulate" the currency style when using decimal 10.4+).

Cheers for the help again