views:

42

answers:

1

Hey guys,

I have a couple of properties declared in my header file, and just wondering when they have to be released. I'm currently doing them in my "dealloc" method, but getting the EXC_BAD_ACCESS error when doing so.

Here's my code

@property (nonatomic, retain) NSTimer *timer;
@property (nonatomic, retain) NSString *closeimage;
@property (nonatomic, retain) NSString *alertStyle;
@property (nonatomic, retain) NSString *phonelaunch;
@property (nonatomic, retain) NSString *resultmessage;

Here's my dealloc method

- (void)dealloc {
    [super dealloc];
    [timer release];
    [closeimage release];
    [alertStyle release];
    [phonelaunch release];
    [resultmessage release];
}

Thanks for any help in advance!

+8  A: 

Put your [super dealloc] message at the end of your dealloc method.

NSResponder
does location of super affect everywhere?i mean with viewDidLoad also...[super viewDidLoad];
Ranjeet Sajwan
Think about what [super dealloc] does. Now, try to imagine what kinds of issues might arise when you try to send messages to objects that are already deallocated.
NSResponder
+1 that is ok...with dealloc...but i want to know about affect ofposition of[super viewDidLoad];or other super statements...
Ranjeet Sajwan