NoobMe
NoobMe

Reputation: 542

Crashing in -dealloc with message sent to deallocated instance

Whenever I build and run I get no errors or warnings. Then I tried setting NSZombieEnabled. I get the following crash:

2011-12-06 16:08:46.869 APITextProject[4194:207] * -[APITextProjectViewController dealloc]: message sent to deallocated instance 0x5a31480

Here is my code:

#pragma ASI Delegate methods
- (void)requestFinished:(ASIHTTPRequest *)request
{
    NSLog(@"Request finished successfully");
    NSLog(@"%@",[request responseString]);

    NSDictionary *responseDictionary = [[request responseString]JSONValue];
    NSDictionary *arrayElement = [responseDictionary objectForKey:@"user"];

    NSString *ID = [arrayElement valueForKeyPath:@"id"];
    NSLog(@"id: %d",ID);
    NSString *usr = [arrayElement valueForKeyPath:@"usr"];
    NSLog(@"usr: %@",usr);
    NSString *gd = [arrayElement valueForKeyPath:@"gd"];
    NSLog(@"gd: %@",gd);
    NSString *age = [arrayElement valueForKeyPath:@"ag"];
    NSLog(@"ag: %@",age);
    NSString *st = [arrayElement valueForKeyPath:@"st"];
    NSLog(@"st: %@",st);
    NSString *lf = [arrayElement valueForKeyPath:@"lf"];
    NSLog(@"lf: %@",lf);
    NSString *da = [arrayElement valueForKeyPath:@"da"];
    NSLog(@"da: %d",da);

    for(NSString *value in [arrayElement allValues]){
        NSLog(@"Found Value %@",value);     
        label.text = value;
        [super release];
    }
}

Upvotes: 1

Views: 524

Answers (3)

vikingosegundo
vikingosegundo

Reputation: 52227

Please delete this line.

[super release];

It should NEVER make sense to call release on super.

Upvotes: 3

Chris Wagner
Chris Wagner

Reputation: 21003

Why are you calling [super release] in your request delegate method? Why would you ever call super release?

Upvotes: 0

Daniel
Daniel

Reputation: 1087

I have a feeling your problem lies in the line [super release] inside the for loop.

Upvotes: 1

Related Questions