Value and Date Created Not Displaying


#1

Looking for some hints here.

I have the exact same code as in the book. In fact, I even copied this chunk from the Solution zip and get the same result. I made sure that the outlets are hooked. I’m not sure what else to look at. The Possession name and serial number display fine.

[nameField setText:[posession possessionName]];
    [serialNumberField setText:[posession serialNumber]];
    [valueField setText:[NSString stringWithFormat:@"%d",[possession valueInDollars]]];
    
    // Create a NSDateFormatter that will turn a date into a simple date string
    NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init]
                                      autorelease];
    [dateFormatter setDateStyle:NSDateFormatterMediumStyle];
    [dateFormatter setTimeStyle:NSDateFormatterNoStyle];
    
    // Use filtered NSDate object to set dateLabel contents
    [dateLabel setText: [dateFormatter stringFromDate:[possession dateCreated]]];

#2

Hi,

It looks like you’ve got some possession vs posession typo’s

I’d guess you have this in the .h file

Possession *posession;
@property (nonatomic, assign) Possession *possession;

HTH

Gareth


#3

Thanks. I couldn’t see the forest for the trees.