ch11. Cocoa Programming - Core Data

Discussion in 'Mac Programming' started by Shogododdo, Jul 1, 2008.

  1. macrumors member

    Joined:
    Apr 25, 2008
    #1
    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.

    Shogo
     
  2. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #2
    Hmm, I've never used the decimal type for entities. Try with a double and see if that works.
     
  3. thread starter macrumors member

    Joined:
    Apr 25, 2008
  4. thread starter macrumors member

    Joined:
    Apr 25, 2008
    #4
    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.
     
  5. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
  6. macrumors newbie

    Joined:
    Apr 26, 2008
    #6
    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.
     
  7. macrumors newbie

    Joined:
    Jun 26, 2008
    #7
    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.
     
  8. thread starter macrumors member

    Joined:
    Apr 25, 2008
    #8
    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.
     
  9. macrumors G4

    Eraserhead

    Joined:
    Nov 3, 2005
    Location:
    UK
    #9
    ^^ Are you on 10.4? 10.4+ formatting doesn't work in that case.
     
  10. thread starter macrumors member

    Joined:
    Apr 25, 2008
    #10
    Guys,

    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
     

Share This Page