EXC_BAD_ACCESS description method



I wrote down the Possession class like this:

//  Possession.m
//  RandomPossession
//  Created by Matteo Lavoro on 30/11/11.
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.

#import "Possession.h"

@implementation Possession

-(NSString*) possessionName{
    return possessionName;
-(NSString*) serialNumber{
    return serialNumber;
-(int) valueInDollars{
    return valueInDollars;
-(NSDate*) dateCreated{
    return dateCreated;

-(void) setPossessionName :(NSString*) newName{
    possessionName = newName;
-(void) setSerialNumber :(NSString*) newSerial{
    serialNumber = newSerial;
-(void) setValueInDollars :(int) newValue{
    valueInDollars = newValue;

//override description
-(NSString*) description {
    NSString* descriptionString = [[NSString alloc] 
                                   initWithFormat:@"%@ (%@) worth: $@d on %@",
    return descriptionString;


but when I execute

        Possession* p = [[Possession alloc] init];
        [p setPossessionName:@"RedSofa"];
        [p setSerialNumber:@"01239"];
        [p setValueInDollars:100];
//        NSLog(@"%@ %@ %d %@", [p possessionName], [p serialNumber], [p valueInDollars], [p dateCreated]);
        NSLog(@"%@", p);

I receive an EXC_BAD_ACCESS and the debugger stops into the description method of Possession.

I can’t find the error… can someone helps me?



Where you have --> initWithFormat:@"%@ (%@) worth: @d on %@" <-- , think it should be %d for the integer valueInDollars.


:blush: this is very noob :smiley:

Thank you!