Phonegap 恢复应用程序崩溃

Posted

技术标签:

【中文标题】Phonegap 恢复应用程序崩溃【英文标题】:Phonegap On Resume App Crash 【发布时间】:2014-04-26 07:34:43 【问题描述】:

每当我的应用程序在 ios7 中从锁定屏幕恢复时,它就会崩溃。问题主要出现在 iOS7 设备中,并且仅在屏幕自动锁定时才会发生。当我解锁屏幕并按下应用程序中的任何 html div 或按钮时,应用程序崩溃。 我已经尝试过这里发布的解决方案 - Workaround for PhoneGap, EXC_BAD_ACCESS on getDeviceInfo 。它不起作用。

崩溃日志如下 -

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0xbe4008d4
Triggered by Thread:  3

Thread 0:
0   libsystem_kernel.dylib          0x38590a84 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3859087c mach_msg + 36
2   CoreFoundation                  0x2dc61554 __CFRunLoopServiceMachPort + 152
3   CoreFoundation                  0x2dc5fcba __CFRunLoopRun + 858
4   CoreFoundation                  0x2dbca46c CFRunLoopRunSpecific + 520
5   CoreFoundation                  0x2dbca24e CFRunLoopRunInMode + 102
6   GraphicsServices                0x329042e6 GSEventRunModal + 134
7   UIKit                           0x3047f840 UIApplicationMain + 1132
8   SkiWithMe                       0x0005f646 0x3f000 + 132678
9   libdyld.dylib                   0x384ecab4 start + 0

Thread 1:
0   libsystem_kernel.dylib          0x38590838 kevent64 + 24
1   libdispatch.dylib               0x384df0d0 _dispatch_mgr_invoke + 228
2   libdispatch.dylib               0x384d961e _dispatch_mgr_thread + 34

Thread 2 name:  com.apple.NSURLConnectionLoader
Thread 2:
0   libsystem_kernel.dylib          0x38590a84 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3859087c mach_msg + 36
2   CoreFoundation                  0x2dc61554 __CFRunLoopServiceMachPort + 152
3   CoreFoundation                  0x2dc5fc74 __CFRunLoopRun + 788
4   CoreFoundation                  0x2dbca46c CFRunLoopRunSpecific + 520
5   CoreFoundation                  0x2dbca24e CFRunLoopRunInMode + 102
6   Foundation                      0x2e6054bc +[NSURLConnection(Loader) _resourceLoadLoop:] + 316
7   Foundation                      0x2e67ac32 __NSThread__main__ + 1058
8   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
9   libsystem_pthread.dylib         0x38609bca _pthread_start + 98
10  libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 3 name:  WebThread
Thread 3 Crashed:
0   WebCore                         0x35b08dba WebCore::TimerBase::heapDeleteMin() + 30
1   WebCore                         0x35b08ca2 WebCore::ThreadTimers::sharedTimerFiredInternal() + 90
2   WebCore                         0x35b08c1e WebCore::timerFired(__CFRunLoopTimer*, void*) + 22
3   CoreFoundation                  0x2dc61e7c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 12
4   CoreFoundation                  0x2dc61a96 __CFRunLoopDoTimer + 790
5   CoreFoundation                  0x2dc5fe1e __CFRunLoopRun + 1214
6   CoreFoundation                  0x2dbca46c CFRunLoopRunSpecific + 520
7   CoreFoundation                  0x2dbca24e CFRunLoopRunInMode + 102
8   WebCore                         0x35b970c0 RunWebThread(void*) + 416
9   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
10  libsystem_pthread.dylib         0x38609bca _pthread_start + 98
11  libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 4:
0   libsystem_kernel.dylib          0x38590a84 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3859087c mach_msg + 36
2   CoreFoundation                  0x2dc61554 __CFRunLoopServiceMachPort + 152
3   CoreFoundation                  0x2dc5fc74 __CFRunLoopRun + 788
4   CoreFoundation                  0x2dbca46c CFRunLoopRunSpecific + 520
5   CoreFoundation                  0x2dbca24e CFRunLoopRunInMode + 102
6   libAVFAudio.dylib               0x2cc395ae GenericRunLoopThread::Entry(void*) + 126
7   libAVFAudio.dylib               0x2cc2dafc CAPThread::Entry(CAPThread*) + 176
8   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
9   libsystem_pthread.dylib         0x38609bca _pthread_start + 98
10  libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 5 name:  javascriptCore::BlockFree
Thread 5:
0   libsystem_kernel.dylib          0x385a2f38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x38609262 _pthread_cond_wait + 538
2   libsystem_pthread.dylib         0x3860a07c pthread_cond_timedwait + 40
3   JavaScriptCore                  0x2ebee55e WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 102
4   JavaScriptCore                  0x2ebee38c JSC::BlockAllocator::blockFreeingThreadMain() + 88
5   JavaScriptCore                  0x2ebeba68 WTF::wtfThreadEntryPoint(void*) + 12
6   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
7   libsystem_pthread.dylib         0x38609bca _pthread_start + 98
8   libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 6 name:  JavaScriptCore::Marking
Thread 6:
0   libsystem_kernel.dylib          0x385a2f38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x38609262 _pthread_cond_wait + 538
2   libsystem_pthread.dylib         0x3860a03c pthread_cond_wait + 36
3   JavaScriptCore                  0x2ed8caea JSC::GCThread::waitForNextPhase() + 74
4   JavaScriptCore                  0x2ed8cb44 JSC::GCThread::gcThreadMain() + 48
5   JavaScriptCore                  0x2ebeba68 WTF::wtfThreadEntryPoint(void*) + 12
6   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
7   libsystem_pthread.dylib         0x38609bca _pthread_start + 98
8   libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 7:
0   libsystem_kernel.dylib          0x385a2f38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x38609262 _pthread_cond_wait + 538
2   libsystem_pthread.dylib         0x3860a03c pthread_cond_wait + 36
3   Foundation                      0x2e6055ba -[NSCondition wait] + 190
4   SkiWithMe                       0x000f3564 0x3f000 + 738660
5   Foundation                      0x2e67ac32 __NSThread__main__ + 1058
6   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
7   libsystem_pthread.dylib         0x38609bca _pthread_start + 98
8   libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 8:
0   libsystem_kernel.dylib          0x38590a84 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3859087c mach_msg + 36
2   CoreFoundation                  0x2dc61554 __CFRunLoopServiceMachPort + 152
3   CoreFoundation                  0x2dc5fc74 __CFRunLoopRun + 788
4   CoreFoundation                  0x2dbca46c CFRunLoopRunSpecific + 520
5   CoreFoundation                  0x2dbca24e CFRunLoopRunInMode + 102
6   Foundation                      0x2e5b8692 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7   Foundation                      0x2e6094d4 -[NSRunLoop(NSRunLoop) run] + 76
8   SkiWithMe                       0x0011b610 0x3f000 + 902672
9   Foundation                      0x2e67ac32 __NSThread__main__ + 1058
10  libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
11  libsystem_pthread.dylib         0x38609bca _pthread_start + 98
12  libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 9 name:  WebCore: CFNetwork Loader
Thread 9:
0   libsystem_kernel.dylib          0x38590a84 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3859087c mach_msg + 36
2   CoreFoundation                  0x2dc61554 __CFRunLoopServiceMachPort + 152
3   CoreFoundation                  0x2dc5fc74 __CFRunLoopRun + 788
4   CoreFoundation                  0x2dbca46c CFRunLoopRunSpecific + 520
5   CoreFoundation                  0x2dbca24e CFRunLoopRunInMode + 102
6   WebCore                         0x35be00a2 WebCore::runLoaderThread(void*) + 250
7   JavaScriptCore                  0x2ebeba68 WTF::wtfThreadEntryPoint(void*) + 12
8   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
9   libsystem_pthread.dylib         0x38609bca _pthread_start + 98
10  libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 10 name:  com.apple.CFSocket.private
Thread 10:
0   libsystem_kernel.dylib          0x385a3440 select$DARWIN_EXTSN + 20
1   CoreFoundation                  0x2dc65456 __CFSocketManager + 482
2   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
3   libsystem_pthread.dylib         0x38609bca _pthread_start + 98
4   libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 11 name:  WebCore: LocalStorage
Thread 11:
0   libsystem_kernel.dylib          0x385a2f38 __psynch_cvwait + 24
1   libsystem_pthread.dylib         0x38609262 _pthread_cond_wait + 538
2   libsystem_pthread.dylib         0x3860a03c pthread_cond_wait + 36
3   JavaScriptCore                  0x2ebee530 WTF::ThreadCondition::timedWait(WTF::Mutex&, double) + 56
4   WebCore                         0x35ccb344 WTF::PassOwnPtr<WTF::Function<void ()> > WTF::MessageQueue<WTF::Function<void ()> >::waitForMessageFilteredWithTimeout<bool (WTF::Function<void ()>*)>(WTF::MessageQueueWaitResult&, bool (&)(WTF::Function<void ()>*), double) + 104
5   WebCore                         0x35ccb2ca WebCore::StorageThread::threadEntryPoint() + 162
6   JavaScriptCore                  0x2ebeba68 WTF::wtfThreadEntryPoint(void*) + 12
7   libsystem_pthread.dylib         0x38609c5a _pthread_body + 138
8   libsystem_pthread.dylib         0x38609bca _pthread_start + 98
9   libsystem_pthread.dylib         0x38607ccc thread_start + 4

Thread 12:
0   libsystem_kernel.dylib          0x385a3c7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x38607e06 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x38607cc0 start_wqthread + 4

Thread 13:
0   libsystem_kernel.dylib          0x385a3c7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x38607e06 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x38607cc0 start_wqthread + 4

Thread 14:
0   libsystem_kernel.dylib          0x385a3c7c __workq_kernreturn + 8
1   libsystem_pthread.dylib         0x38607e06 _pthread_wqthread + 306
2   libsystem_pthread.dylib         0x38607cc0 start_wqthread + 4

Thread 3 crashed with ARM Thread State (32-bit):
    r0: 0x800004f8    r1: 0x3e4003e0      r2: 0xbe4008d8      r3: 0x00000040
    r4: 0x02b1c3c0    r5: 0x04602e74      r6: 0x04602e74      r7: 0x02d0308c
    r8: 0x16dc6528    r9: 0x0f9000f8     r10: 0x00000000     r11: 0x16dc64d0
    ip: 0x38940808    sp: 0x02d0307c      lr: 0x35b08ca7      pc: 0x35b08dba
  cpsr: 0x20000030

【问题讨论】:

【参考方案1】:

我认为当你的应用程序从后台回到前台时你遇到了问题,所以这是由于你试图在后台访问一些数据或数组到前台时发生的。var 或数组无法访问或你定义的动态值就是这样为什么它会导致崩溃。

【讨论】:

你能详细说明一下吗?我现在也有同样的问题。我们已将其隔离为 CDVConnection 插件和 onResume 方法/事件。 我也遇到了同样的问题。有人知道更多吗?

以上是关于Phonegap 恢复应用程序崩溃的主要内容,如果未能解决你的问题,请参考以下文章

由于应用程序在启动时崩溃,Phonegap ios 应用程序被拒绝

安装插件后phonegap应用程序崩溃

带有 Phonegap 的 Android 应用程序在横向旋转时崩溃

PhoneGap / iOS LocalNotification 应用程序在点击“查看”时崩溃

在 PhoneGap 应用程序中,MessgeUI.framework 仅在 iOS 设备中崩溃

Phonegap|Android 4 - 从 PHOTOLIBRARY 拍照时,应用程序有时会崩溃