Iphone 内存崩溃更新UIActivityIndicatorView

Iphone 内存崩溃更新UIActivityIndicatorView,iphone,Iphone,每当我试图从线程更新UIActivityIndicatorView时,应用程序都会因引发异常而崩溃 正在修改正在最终确定的层-0x7e177fd0 -[CALayer removeAnimationForKey:]:消息已发送到解除分配的实例0x7e177fd0 当我尝试从mallocDebugger工具跟踪内存泄漏时,这种崩溃在任何时候都不会发生,10次中有1次发生 请帮我解决这个记忆问题 线程实现: NSAutoreleasePool *pool = [[NSAutoreleasePool

每当我试图从线程更新
UIActivityIndicatorView
时,应用程序都会因引发异常而崩溃

正在修改正在最终确定的层-0x7e177fd0 -[CALayer removeAnimationForKey:]:消息已发送到解除分配的实例0x7e177fd0

当我尝试从mallocDebugger工具跟踪内存泄漏时,这种崩溃在任何时候都不会发生,10次中有1次发生

请帮我解决这个记忆问题

线程实现:

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc]init];

[autoRechargeCell addSubview:activityIndicator];
[self.activityIndicator startAnimating];
if( [PennyTalkAPI getBalanceInfoForAccount:appDelegate.accountNumber withPIN:appDelegate.pinNumber])
{   
    [autoRechargeCell.switchField setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@"AutoRecharge"]];
    [self.activityIndicator stopAnimating];   <<<<<<<<<<<<<<<<<<<<<< 
}
else
{
    [self.activityIndicator stopAnimating];
}

[pool release]; 
NSAutoreleasePool*pool=[[NSAutoreleasePool alloc]init];
[autoRechargeCell addSubview:activityIndicator];
[self.activityIndicator startAnimating];
if([PennyTalkAPI getBalanceInfoForAccount:appDelegate.accountNumber with PIN:appDelegate.pinNumber])
{   
[autoRechargeCell.switchField设置:[[NSUserDefaults standardUserDefaults]布尔工作:@“AutoRecharge”];

[self.activityIndicator stop animating];您正在从次线程更新它,这就是它崩溃的原因在主线程上调用此命令,如

   [self.activityIndicator performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:NO];  
我想它可能会帮助你……

看看这个。 将[[NSNotificationCenter defaultCenter]removeObserver:self];添加到UIActivityIndicatorView+AFNetworking.m dealloc

谢谢zartha我从你的回答中找到了答案。再次感谢。