3

我的应用程序使用后台位置进行 GPS 更新。我已经为后台位置更新注册了它,当它在后台运行时,它总是像这样崩溃。

由于我还没有编写大部分代码,我真的不知道发生了什么。

我检查了内存分配,那里似乎没有太大问题。这是崩溃报告:

Incident Identifier: 39F6F622-1274-4B6C-BA19-32D10E04E309
CrashReporter Key:   4757f4c5e5f009daf18eb0c512f729356c3e5de4
Hardware Model:      iPhone3,1
Process:         Get Off Now! [3040]
Path:            /var/mobile/Applications/43D41F77-B225-4F47-AFB0-D2F2E00E18DF/Get Off Now!.app/Get Off Now!
Identifier:      Get Off Now!
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-12-22 13:31:29.293 +0800
OS Version:      iPhone OS 4.1 (8B117)
Report Version:  104

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000d
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib                 0x000027d8 objc_msgSend + 16
1   CoreFoundation                  0x000042ae CFRetain + 62
2   CoreFoundation                  0x0005ab58 CFMessagePortInvalidate + 304
3   CoreFoundation                  0x0005b05e CFMessagePortIsValid + 42
4   CoreLocation                    0x000030f8 CLClientIsValid + 12
5   CoreLocation                    0x00004b10 CLClientSendAndCache(__CLClient*, CLDaemonCommType, void*, int, unsigned char, unsigned char) + 40
6   CoreLocation                    0x000051cc CLClientHandleWatchdogTimerExpiry(__CFRunLoopTimer*, void*) + 24
7   CoreFoundation                  0x000567f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
8   CoreFoundation                  0x000562a6 __CFRunLoopDoTimer + 854
9   CoreFoundation                  0x0002779e __CFRunLoopRun + 1082
10  CoreFoundation                  0x00027270 CFRunLoopRunSpecific + 224
11  CoreFoundation                  0x00027178 CFRunLoopRunInMode + 52
12  GraphicsServices                0x000045ec GSEventRunModal + 108
13  GraphicsServices                0x00004698 GSEventRun + 56
14  UIKit                           0x0000411c -[UIApplication _run] + 396
15  UIKit                           0x00002128 UIApplicationMain + 664
16  Get Off Now!                    0x00002406 0x1000 + 5126
17  Get Off Now!                    0x000023d0 0x1000 + 5072

Thread 1:
0   libSystem.B.dylib               0x0002d330 kevent + 24
1   libSystem.B.dylib               0x000d6b6c _dispatch_mgr_invoke + 88
2   libSystem.B.dylib               0x000d65bc _dispatch_queue_invoke + 96
3   libSystem.B.dylib               0x000d675c _dispatch_worker_thread2 + 120
4   libSystem.B.dylib               0x0007a67a _pthread_wqthread + 258
5   libSystem.B.dylib               0x00073190 start_wqthread + 0

Thread 2:
0   libSystem.B.dylib               0x00000cf4 semaphore_wait_signal_trap + 8
1   libSystem.B.dylib               0x0002e4ee semaphore_wait_signal + 2
2   libSystem.B.dylib               0x00002ae4 pthread_mutex_lock + 248
3   WebCore                         0x00002620 _WebTryThreadLock(bool) + 140
4   WebCore                         0x00002566 WebRunLoopLock(__CFRunLoopObserver*, unsigned long, void*) + 18
5   CoreFoundation                  0x00030236 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 10
6   CoreFoundation                  0x000300aa __CFRunLoopDoObservers + 406
7   CoreFoundation                  0x000276c0 __CFRunLoopRun + 860
8   CoreFoundation                  0x00027270 CFRunLoopRunSpecific + 224
9   CoreFoundation                  0x00027178 CFRunLoopRunInMode + 52
10  WebCore                         0x000024e2 RunWebThread(void*) + 362
11  libSystem.B.dylib               0x0007a27e _pthread_start + 242
12  libSystem.B.dylib               0x0006f2a8 thread_start + 0

Thread 3:
0   libSystem.B.dylib               0x0007b19c __workq_kernreturn + 8
1   libSystem.B.dylib               0x0007a790 _pthread_wqthread + 536
2   libSystem.B.dylib               0x00073190 start_wqthread + 0

Thread 4:
0   libSystem.B.dylib               0x0007b19c __workq_kernreturn + 8
1   libSystem.B.dylib               0x0007a790 _pthread_wqthread + 536
2   libSystem.B.dylib               0x00073190 start_wqthread + 0

Thread 0 crashed with ARM Thread State:
    r0: 0x001a01c0    r1: 0x33024270      r2: 0x00000005      r3: 0x3002d7c9
    r4: 0x00000005    r5: 0x3e1af5e4      r6: 0x00000017      r7: 0x2fffeac0
    r8: 0x00000004    r9: 0x001fc098     r10: 0x00855864     r11: 0x2fffeb48
    ip: 0x3e19c3f0    sp: 0x2fffeaa8      lr: 0x307fc2b5      pc: 0x3002d7d8
  cpsr: 0x20000030

这是它崩溃的另一种方式;它看起来一样,除了它长时间使用 100% CPU:

Incident Identifier: 61B42F36-021F-48D2-B180-112527BAE5CF
CrashReporter Key:   4757f4c5e5f009daf18eb0c512f729356c3e5de4
Hardware Model:      iPhone3,1
Process:         Get Off Now! [3751]
Path:            /var/mobile/Applications/43D41F77-B225-4F47-AFB0-D2F2E00E18DF/Get Off Now!.app/Get Off Now!
Identifier:      Get Off Now!
Version:         ??? (???)
Code Type:       ARM (Native)
Parent Process:  launchd [1]

Date/Time:       2010-12-23 13:06:50.363 +0800
OS Version:      iPhone OS 4.1 (8B117)
Report Version:  104

Exception Type:  00000020
Exception Codes: 0x8badf00d
Highlighted Thread:  0

Application Specific Information:
Get Off Now![3751] has active assertions beyond permitted time: 
{(
    <SBProcessAssertion: 0xca2a8a0> identifier: CoreLocationRegistration process: Get Off Now![3751] permittedBackgroundDuration: 600.000000 reason: finishTask owner pid:3751 preventSuspend  preventIdleSleep 
)}

Elapsed total CPU time (seconds): 600.010 (user 19.350, system 580.660), 100% CPU 
Elapsed application CPU time (seconds): 575.320, 96% CPU

Thread 0:
0   libSystem.B.dylib               0x00004f0c OSSpinLockLock + 44
1   CoreFoundation                  0x0005aa42 CFMessagePortInvalidate + 26
2   CoreFoundation                  0x0005b05e CFMessagePortIsValid + 42
3   CoreLocation                    0x000030f8 CLClientIsValid + 12
4   CoreLocation                    0x00004b10 CLClientSendAndCache(__CLClient*, CLDaemonCommType, void*, int, unsigned char, unsigned char) + 40
5   CoreLocation                    0x000051cc CLClientHandleWatchdogTimerExpiry(__CFRunLoopTimer*, void*) + 24
6   CoreFoundation                  0x000567f4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
7   CoreFoundation                  0x000562a6 __CFRunLoopDoTimer + 854
8   CoreFoundation                  0x0002779e __CFRunLoopRun + 1082
9   CoreFoundation                  0x00027270 CFRunLoopRunSpecific + 224
10  CoreFoundation                  0x00027178 CFRunLoopRunInMode + 52
11  GraphicsServices                0x000045ec GSEventRunModal + 108
12  GraphicsServices                0x00004698 GSEventRun + 56
13  UIKit                           0x0000411c -[UIApplication _run] + 396
14  UIKit                           0x00002128 UIApplicationMain + 664
15  Get Off Now!                    0x000022de main (main.m:13)
16  Get Off Now!                    0x000022a8 start + 32

Thread 1:
0   libSystem.B.dylib               0x0002d330 kevent + 24
1   libSystem.B.dylib               0x000d6b6c _dispatch_mgr_invoke + 88
2   libSystem.B.dylib               0x000d65bc _dispatch_queue_invoke + 96
3   libSystem.B.dylib               0x000d675c _dispatch_worker_thread2 + 120
4   libSystem.B.dylib               0x0007a67a _pthread_wqthread + 258
5   libSystem.B.dylib               0x00073190 start_wqthread + 0

Thread 2:
0   libSystem.B.dylib               0x00000c98 mach_msg_trap + 20
1   libSystem.B.dylib               0x00002d64 mach_msg + 44
2   CoreFoundation                  0x00027c38 __CFRunLoopServiceMachPort + 88
3   CoreFoundation                  0x000274c2 __CFRunLoopRun + 350
4   CoreFoundation                  0x00027270 CFRunLoopRunSpecific + 224
5   CoreFoundation                  0x00027178 CFRunLoopRunInMode + 52
6   WebCore                         0x000024e2 RunWebThread(void*) + 362
7   libSystem.B.dylib               0x0007a27e _pthread_start + 242
8   libSystem.B.dylib               0x0006f2a8 thread_start + 0

Unknown thread crashed with unknown flavor: 5, state_count: 1
4

2 回答 2

1

我认为您需要检查一些由其他线程释放的对象,但它们是由主线程访问的。我遇到了这样的事情,那是因为我访问了一些已经释放的对象。

于 2010-12-23T06:43:32.257 回答
0

我生成了完全相同的崩溃日志。我有一个主线程,它使用 NSOperationQueue 生成数据下载线程,然后在完成后使用 performSelectorOnMainThread。

在我的 didupdatelocation 方法中,我在一个数组中循环,在某些情况下会启动一个本地通知。它似乎在本地通知的第二个实例上失败(对于同一个数组项),但我不能确定。我确实尝试对日志进行符号化,但是 4.2.1 存在一些丢失的文件错误,所以我从 4.2 中复制了符号,并且无法让 atos 工作(但这可能是我的错)。

昨晚我做了以下更改,一切似乎都解决了:

1) 将所有 self.locationManager 符号更改为仅 locationManager

2) 从 appdelegate 中的 dealloc 方法中删除所有内容(除了 super)

于 2011-03-01T03:53:22.567 回答