我们的应用已使用与大致1 1500发射的频率崩溃由于是难以捉摸的错误。堆栈跟踪的相关部分是包括在内。它是被解雇的回调,所以我对那里它发生在我自己的代码中没有引用。

它看起来像发生了什么事情,就表示有是调用UIViewAnimationState私有方法(UIAlertView's)一个_popoutAnimationDidStop:finished:对象。唯一的问题是,它出现在UIAlertView已经由这点dealloced。我没有做任何怪异与警示的意见。我把他们了,我等待用户输入。它们被释放之前全部示出。

任何人都遇到过这个?在这一点上,我倾向于这是一个苹果的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中试图调用它代表了一种方法,委托被释放之后。为了防止这种类型的bug,任何时候你设置一个对象作为另一个对象的委托,将委托属性设为零的委托对象的dealloc方法。 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
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top