在-dealloc中崩溃,并将消息发送到解除分配的实例

时间:2011-12-06 08:17:24

标签: objective-c ios cocoa-touch uiviewcontroller crash

每当我构建并运行时,我都不会收到任何错误或警告。然后我尝试设置NSZombieEnabled。我得到了以下崩溃:

  

2011-12-06 16:08:46.869 APITextProject [4194:207] * - [APITextProjectViewController dealloc]:发送到解除分配的实例0x5a31480的消息

这是我的代码:

#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];
    }
}

2 个答案:

答案 0 :(得分:3)

请删除此行。

[super release];

在超级电话上调用发布应该没有意义。

答案 1 :(得分:0)

为什么在请求委托方法中调用[super release]?你为什么要打超级发布?