当改变ViewController时,需要覆盖dealloc方法吗?

时间:2014-04-25 01:14:50

标签: ios

_request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:url]];
[_request setPostValue:emailFiled.text forKey:@"Mail"];
[_request setPostValue:accountFiled.text forKey:@"UserAccount"];//帐户
[_request setPostValue:[self md5:passwordFiled.text] forKey:@"PassWord"];//密码
[_request setTimeOutSeconds:10];
[_request setDelegate:nil];
[_request startAsynchronous];
[_request setCompletionBlock:^{}];

- (void)dealloc{
    [_request clearDelegatesAndCancel];
    [_request release];
    [super dealloc];
}

更改ViewController时,需要覆盖dealloc方法吗?

1 个答案:

答案 0 :(得分:0)

如果您使用ARC,我认为您应该实现dealloc功能。在此功能中,您:

  1. 将委托分配给nil

  2. 删除观察者

  3. 如果您不使用ARC,则必须实现dealloc函数以释放ivar变量。