2012-02-15 15 views
1

厄介なクラッシュを修正するのに問題があります。私は正確にそれを再現する方法を把握することができません、 しかし、それは、アプリがバックグラウンドから出た後にのみ発生します。私は2日以上毎にこのクラッシュを受ける。バックグラウンドでレイヤーアニメーション中にiPhoneがクラッシュする

applicationDidBecomeActive:では、0.4秒ごとに起動するタイマーを再起動します。

- (void)rotate { 

    [UIView beginAnimations:nil context:nil]; 
    [UIView setAnimationDuration:0.3]; 
    self.transform = CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(-[LocationModel instance].heading.magneticHeading)); 
    [UIView commitAnimations]; 

} 

また、RotateViewでは、クラッシュレポートに表示されるボディが41行目であるdrawRectもあります。

- (void)drawRect:(CGRect)rect { 

    [img drawInRect:rect]; // line 41 
} 

IMGはimageNamedを装填小さいUIImageであり:そしてIVARに格納されています。

アドバイスはありますか?クラッシュレポートの経験はほとんどありません。

ありがとうございます!


クラッシュレポート:

Exception Type: EXC_BAD_ACCESS (SIGSEGV) 
Exception Codes: KERN_INVALID_ADDRESS at 0x3001b482 
Crashed Thread: 0 

Thread 0 name: Dispatch queue: com.apple.main-thread 
Thread 0 Crashed: 
0 libobjc.A.dylib     0x333a6c98 objc_msgSend + 16 
1 MyApp       0x000259bc -[RotateView drawRect:] (RotateView.m:41) 
2 UIKit        0x34f4a9fe -[UIView(CALayerDelegate) drawLayer:inContext:] + 258 
3 QuartzCore      0x3058efa6 -[CALayer drawInContext:] + 86 
4 QuartzCore      0x3058ed24 _ZL16backing_callbackP9CGContextPv + 32 
5 QuartzCore      0x3058e776 CABackingStoreUpdate + 1226 
6 QuartzCore      0x3058e178 -[CALayer _display] + 724 
7 QuartzCore      0x3058de86 -[CALayer display] + 134 
8 QuartzCore      0x30582706 CALayerDisplayIfNeeded + 178 
9 QuartzCore      0x305821c6 CA::Context::commit_transaction(CA::Transaction*) + 214 
10 QuartzCore      0x30581fd0 CA::Transaction::commit() + 184 
11 QuartzCore      0x30580900 CA::Transaction::pop() + 120 
12 QuartzCore      0x3058087e +[CATransaction commit] + 22 
13 UIKit        0x35096bcc _UIWindowUpdateVisibleContextOrder + 136 
14 UIKit        0x35096c60 +[UIWindow _prepareWindowsForAppResume] + 4 
15 UIKit        0x3508f3de -[UIApplication _handleApplicationResumeEvent:] + 66 
16 UIKit        0x34f39e20 -[UIApplication handleEvent:withNewEvent:] + 2724 
17 UIKit        0x34f3920e -[UIApplication sendEvent:] + 38 
18 UIKit        0x34f38c4c _UIApplicationHandleEvent + 5084 
19 GraphicsServices     0x35873e70 PurpleEventCallback + 660 
20 GraphicsServices     0x35873efa PurpleEventSignalCallback + 10 
21 CoreFoundation     0x36126a72 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 6 
22 CoreFoundation     0x36128758 __CFRunLoopDoSources0 + 376 
23 CoreFoundation     0x361294e4 __CFRunLoopRun + 224 
24 CoreFoundation     0x360b9ebc CFRunLoopRunSpecific + 224 
25 CoreFoundation     0x360b9dc4 CFRunLoopRunInMode + 52 
26 GraphicsServices     0x35873418 GSEventRunModal + 108 
27 GraphicsServices     0x358734c4 GSEventRun + 56 
28 UIKit        0x34f63d62 -[UIApplication _run] + 398 
29 UIKit        0x34f61800 UIApplicationMain + 664 
30 MyApp       0x000026c4 main (main.m:14) 
31 MyApp       0x0000266c start + 32 

答えて

1

EXC_BAD_ACCESSは一般的に、後でそのオブジェクトを呼び出した後、オブジェクトを解放を意味します。 NSZombiesを有効にしてみてください。それを行う方法に関する多数のチュートリアルがあります。開始するにはここをクリックhttp://www.touch-code-magazine.com/how-to-debug-exc_bad_access/

+0

すでに有効になっています。 NSZombiesはクラッシュログに何かを表示しますか? –

+0

ゾンビが有効になっていると、私は通常、 'disallocated instance 0x80d7c00に送信されたメッセージ'のようなものを取得し、そこから移動します。楽器を試してみることもできますし、ゾンビを見つける方法もあります。 – tassinari

+0

私はこれらのツールを理解していますが、上記のように、クラッシュは頻繁に起こりません。私はデバイスを介してデバッグすることはできません。 –

関連する問題