问题描述
我们的应用程序崩溃了大约1在1,500发射的频率,由于一个错误,被证明是难以捉摸。包括堆栈跟踪的相关部分。它是作为回调被触发,所以我没有参考它在我自己的代码中发生的地方。
Our app has been crashing with a frequency of roughly 1 in 1,500 launches due to a bug that is proving elusive. The relevant portion of the stack trace is included. It's being fired as a callback so I have no reference for where it's occurring in my own code.
看起来像是发生了一个 私有方法(
_popoutAnimationDidStop:finished:
)调用> UIViewAnimationState
只有问题是,出现 UIAlertView
已经被这一点抛弃。我不做任何奇怪的警报视图。我抛出他们,我等待用户输入。
It looks like what's going on is there is a UIViewAnimationState
object that is calling UIAlertView's
private method (_popoutAnimationDidStop:finished:
). Only problem is, it appears the UIAlertView
has been dealloced by this point. I don't do anything weird with alert views. I throw them up, and I wait for user input. They are all shown before being released.
任何人遇到这个问题?在这一点上,我倾向于是一个苹果bug。
Anyone encountered this? At this point, I'm leaning toward it being an Apple bug.
Thread 0 Crashed:
0 libobjc.A.dylib 0x3138cec0 objc_msgSend + 24
1 UIKit 0x326258c4 -[UIAlertView(Private) _popoutAnimationDidStop:finished:]
2 UIKit 0x324fad70 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:]
3 UIKit 0x324fac08 -[UIViewAnimationState animationDidStop:finished:]
4 QuartzCore 0x311db05c run_animation_cal
lbacks
推荐答案
很可能UIAlertView正在试图在委托释放后对其委托调用一个方法。为了防止这种类型的错误,任何时候将对象设置为另一个对象的委托,请在委托对象的dealloc方法中将委托属性设置为nil。例如
It's likely that UIAlertView is trying to call a method on its delegate after that delegate has been released. To prevent this type of bug, any time you set an object as another object's delegate, set the delegate property to nil in the delegate object's dealloc method. e.g.
@implementation YourViewController
@synthesize yourAlertView;
- (void)dealloc {
yourAlertView.delegate = nil; // Ensures subsequent delegate method calls won't crash
self.yourAlertView = nil; // Releases if @property (retain)
[super dealloc];
}
- (IBAction)someAction {
self.yourAlertView = [[[UIAlertView alloc] initWithTitle:@"Pushed"
message:@"You pushed a button"
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil] autorelease];
[self.yourAlertView show];
}
// ...
@end
这篇关于UIAlertView崩溃对未记录的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!