7

私たちのアプリは、とらえどころのないバグが原因で、約 1,500 回の起動に 1 回の頻度でクラッシュしています。スタック トレースの関連部分が含まれています。コールバックとして起動されているため、自分のコードで発生している場所を参照することはできません。

プライベート メソッド ( )UIViewAnimationStateを呼び出しているオブジェクトがあるようです。唯一の問題は、この時点で割り当てが解除されているように見えることです。アラート ビューで奇妙なことは何もしません。それらを投げて、ユーザーの入力を待ちます。すべて公開前に公開されています。UIAlertView's_popoutAnimationDidStop:finished:UIAlertView

誰もこれに遭遇しましたか?この時点で、私はそれが Apple のバグであることに傾いています。

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

ポンドバック

4

1 に答える 1

12

デリゲートが解放された後、UIAlertView がデリゲートのメソッドを呼び出そうとしていると考えられます。この種のバグを防ぐには、オブジェクトを別のオブジェクトのデリゲートとして設定するときはいつでも、デリゲート オブジェクトの dealloc メソッドでデリゲート プロパティを nil に設定します。例えば


@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
于 2010-04-05T23:21:49.957 に答える