我有点卡住了,需要解决这个问题,因为我的一个应用程序出现了随机崩溃,无法永远复制。这是崩溃日志之一:
Incident Identifier: 59865612-9F00-44EA-9474-2BF607AD662E
CrashReporter Key: bea17b7f4237e78a13ce60449d694621d0f16a44
Hardware Model: iPhone2,1
Process: APPNAME [82]
Path: /var/mobile/Applications/ACE9A1A2-F1BE-43E0-9775-1291723D4C4A/APPNAME.app/APPNAME
Identifier: APPNAME
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2011-05-21 19:10:27.893 +0100
OS Version: iPhone OS 4.3.3 (8J2)
Report Version: 104
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x00000009
Crashed Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libobjc.A.dylib 0x33b24c98 objc_msgSend + 16
1 Foundation 0x344507b4 __NSFireTimer + 112
2 CoreFoundation 0x3039ca40 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
3 CoreFoundation 0x3039eec4 __CFRunLoopDoTimer + 844
4 CoreFoundation 0x3039f83e __CFRunLoopRun + 1082
5 CoreFoundation 0x3032febc CFRunLoopRunSpecific + 224
6 CoreFoundation 0x3032fdc4 CFRunLoopRunInMode + 52
7 GraphicsServices 0x3448e418 0x3448a000 + 17432
8 GraphicsServices 0x3448e4c4 0x3448a000 + 17604
9 UIKit 0x33f3cd62 -[UIApplication _run] + 398
10 UIKit 0x33f3a800 UIApplicationMain + 664
11 APPNAME 0x00002d88 0x1000 + 7560
12 APPNAME 0x00002d3c 0x1000 + 7484
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x36100fbc kevent + 24
1 libdispatch.dylib 0x33d0b032 _dispatch_mgr_invoke + 706
2 libdispatch.dylib 0x33d0c03a _dispatch_queue_invoke + 86
3 libdispatch.dylib 0x33d0b5ea _dispatch_worker_thread2 + 186
4 libsystem_c.dylib 0x33e0a58a _pthread_wqthread + 258
5 libsystem_c.dylib 0x33e0abbc start_wqthread + 0
Thread 2 name: WebThread
Thread 2:
0 libsystem_kernel.dylib 0x360fdc00 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x360fd758 mach_msg + 44
2 CoreFoundation 0x3039d2b8 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x3039f562 __CFRunLoopRun + 350
4 CoreFoundation 0x3032febc CFRunLoopRunSpecific + 224
5 CoreFoundation 0x3032fdc4 CFRunLoopRunInMode + 52
6 WebCore 0x34c2627e RunWebThread(void*) + 382
7 libsystem_c.dylib 0x33e0930a _pthread_start + 242
8 libsystem_c.dylib 0x33e0abb4 thread_start + 0
Thread 3:
0 libsystem_kernel.dylib 0x360fdc00 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x360fd758 mach_msg + 44
2 CoreFoundation 0x3039d2b8 __CFRunLoopServiceMachPort + 88
3 CoreFoundation 0x3039f562 __CFRunLoopRun + 350
4 CoreFoundation 0x3032febc CFRunLoopRunSpecific + 224
5 CoreFoundation 0x3032fdc4 CFRunLoopRunInMode + 52
6 Foundation 0x343ea7f6 +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] + 206
7 Foundation 0x343dd382 -[NSThread main] + 38
8 Foundation 0x3444f5c6 __NSThread__main__ + 966
9 libsystem_c.dylib 0x33e0930a _pthread_start + 242
10 libsystem_c.dylib 0x33e0abb4 thread_start + 0
Thread 4 name: com.apple.CFSocket.private
Thread 4:
0 libsystem_kernel.dylib 0x360ffc60 __select + 20
1 CoreFoundation 0x303a28f2 __CFSocketManager + 582
2 libsystem_c.dylib 0x33e0930a _pthread_start + 242
3 libsystem_c.dylib 0x33e0abb4 thread_start + 0
Thread 5:
0 libsystem_kernel.dylib 0x361003ec __workq_kernreturn + 8
1 libsystem_c.dylib 0x33e0a6d8 _pthread_wqthread + 592
2 libsystem_c.dylib 0x33e0abbc start_wqthread + 0
Thread 6:
0 libsystem_kernel.dylib 0x361003ec __workq_kernreturn + 8
1 libsystem_c.dylib 0x33e0a6d8 _pthread_wqthread + 592
2 libsystem_c.dylib 0x33e0abbc start_wqthread + 0
Thread 7:
0 libsystem_kernel.dylib 0x361003ec __workq_kernreturn + 8
1 libsystem_c.dylib 0x33e0a6d8 _pthread_wqthread + 592
2 libsystem_c.dylib 0x33e0abbc start_wqthread + 0
Thread 8:
0 libsystem_kernel.dylib 0x361003ec __workq_kernreturn + 8
1 libsystem_c.dylib 0x33e0a6d8 _pthread_wqthread + 592
2 libsystem_c.dylib 0x33e0abbc start_wqthread + 0
Thread 0 crashed with ARM Thread State:
r0: 0x04246810 r1: 0x33738814 r2: 0x042b3704 r3: 0x00000000
r4: 0x00000001 r5: 0x00000001 r6: 0x00259330 r7: 0x2fdfeb30
r8: 0x002593d0 r9: 0x00000000 r10: 0x04241720 r11: 0x00000000
ip: 0x3fa3f4e8 sp: 0x2fdfea60 lr: 0x349077bb pc: 0x33dfcc98
cpsr: 0x280f0030
有人可以就可能的原因提出建议吗?
谢谢!
答案 0 :(得分:6)
看起来你有一个计时器触发并尝试向已经被释放的对象发送消息。
答案 1 :(得分:2)
Keyline在这里是:Exception Type: EXC_BAD_ACCESS (SIGBUS)
当您尝试访问之前已发布的对象时,会发生这种情况。因为,您试图访问计时器回调中的对象,所以可能发生的事情是,当计时器响应对象时,相关对象已被释放。
来跟踪对象答案 2 :(得分:1)
当您创建NSTimer时,如果要调用的对象消失,请务必保留ref然后使其无效。像这样:
[self.bugZapTimer invalidate];
self.bugZapTimer = [NSTimer timerWithTimeInterval: 0.1
target: self
selector: @selector(bugZapTimer:)
userInfo: NULL
repeats: FALSE];
[[NSRunLoop currentRunLoop] addTimer:self.bugZapTimer forMode: NSDefaultRunLoopMode];
然后,在你的dealloc方法中你必须这样做:
[self.bugZapTimer invalidate];
self.bugZapTimer = nil;