>每当我尝试从线程更新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];
这是我编写的代码。
看到这个。 添加 [[NSNotificationCenter defaultCenter] removeObserver:self];to UIActivityIndicatorView+AFNetworking.m deallochttps://github.com/AFNetworking/AFNetworking/issues/2748
您正在从辅助线程更新它,为什么它会崩溃,例如在主线程上调用它
[self.activityIndicator performSelectorOnMainThread:@selector(stopAnimating) withObject:nil waitUntilDone:NO];
我认为它可能会对你有所帮助....