【发布时间】:2012-04-13 13:03:57
【问题描述】:
当我尝试从线程更新 UIActivityIndicatorView 时。应用程序因抛出异常而崩溃 正在完成的修改层 - 0x7e177fd0 -[CALayer removeAnimationForKey:]:消息发送到释放的实例 0x7e177fd0 。 当我尝试从 mallocDebugger 工具中跟踪内存泄漏时。
这种崩溃并非总是发生 1/10
请帮我解决这个内存问题
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 withPIN:appDelegate.pinNumber]) { [autoRechargeCell.switchField setOn:[[NSUserDefaults standardUserDefaults] boolForKey:@"AutoRecharge"]]; [self.activityIndicator stopAnimating]; } else { [self.activityIndicator stopAnimating]; } [池释放];
-
这是我写的代码
标签: iphone