当在模拟器中的模式显示控制器中输入UITextField时,应用程序会被卡住



在iPad Simulator 5.0的调试模式下,使用Monotouch 5.2.5运行我的应用程序会产生非常非常奇怪的效果。

我在界面生成器中构建了一个通用视图控制器。它有一个UITextField和一个UITextView

如果我把控制器推到导航堆栈上,我就可以很好地使用它。然而,如果我以模式呈现它,我可以在其中一个输入字段中键入视图字符,那么应用程序就会卡住。不再有输入,没有崩溃,控制台日志中没有任何内容。它只是挂着。这是可重复的每一次。

我在控制器的终结器中放置了一个断点:未被调用。此外,如果我在继承自UITextField的控制器中添加另一个自定义控件,我可以毫无问题地使用该控件。

编辑:

  • 它只是在模拟器上崩溃
  • 如果我禁用输入字段上的自动校正,它将在模拟器中工作

这是GDB的输出,但我不知道它能告诉我什么:

(gdb) thread apply all backtrace
Thread 11 (process 65850):
#0  0x97d30c76 in semaphore_timedwait_trap ()
#1  0x0020c185 in mono_sem_timedwait (sem=0x2f52c8, timeout_ms=2000, alertable=1) at mono-semaphore.c:76
#2  0x001cc404 in async_invoke_thread (data=0x0) at threadpool.c:1497
#3  0x001d1e16 in start_wrapper_internal [inlined] () at :784
#4  0x001d1e16 in start_wrapper (data=0x9c56770) at threads.c:832
#5  0x00203cfa in thread_start_routine (args=0xe222a70) at wthreads.c:287
#6  0x001aeb20 in gc_start_thread (arg=0x9c563a0) at sgen-gc.c:6196
#7  0x9c596ed9 in _pthread_start ()
#8  0x9c59a6de in thread_start ()
Thread 10 (process 65850):
#0  0x97d32bb2 in __semwait_signal ()
#1  0x9c54b7b9 in nanosleep$UNIX2003 ()
#2  0x00202ed7 in SleepEx (ms=500, alertable=1) at wthreads.c:1027
#3  0x001c92d7 in monitor_thread (unused=0x0) at threadpool.c:781
#4  0x001d1e16 in start_wrapper_internal [inlined] () at :784
#5  0x001d1e16 in start_wrapper (data=0x9c57180) at threads.c:832
#6  0x00203cfa in thread_start_routine (args=0xe2229f4) at wthreads.c:287
#7  0x001aeb20 in gc_start_thread (arg=0x9c56770) at sgen-gc.c:6196
#8  0x9c596ed9 in _pthread_start ()
#9  0x9c59a6de in thread_start ()
Thread 9 (process 65850):
#0  0x97d3283e in __psynch_cvwait ()
#1  0x9c59ae21 in _pthread_cond_wait ()
#2  0x9c54b42c in pthread_cond_wait$UNIX2003 ()
#3  0x001ef302 in _wapi_handle_timedwait_signal_handle (handle=0x10f, timeout=0x0, alertable=1, poll=0) at handles.c:1655
#4  0x001ef348 in _wapi_handle_wait_signal_handle (handle=0x10f, alertable=1) at handles.c:1598
#5  0x00200e58 in WaitForSingleObjectEx (handle=0x131, timeout=4294967295, alertable=1) at wait.c:203
#6  0x001d081d in ves_icall_System_Threading_WaitHandle_WaitOne_internal (this=0xc6a2ed8, handle=0x10f, ms=-1, exitContext=0) at threads.c:1665
#7  0x12f9bf7e in ?? ()
#8  0x12f9b9e4 in ?? ()
#9  0x12f9b4d3 in ?? ()
#10 0x12f99a40 in ?? ()
#11 0x12f972be in ?? ()
#12 0x099eaa50 in ?? ()
#13 0x00010222 in mono_jit_runtime_invoke (method=0xe356e14, obj=0xc6a2fb0, params=0xb06daf34, exc=0x0) at mini.c:5797
#14 0x00171f6e in mono_runtime_invoke (method=0xe356e14, obj=0xc6a2fb0, params=0xb06daf34, exc=0x0) at object.c:2757
#15 0x001720ac in mono_runtime_delegate_invoke (delegate=0xc6a2fb0, params=0xb06daf34, exc=0x0) at object.c:3422
#16 0x001d1e42 in start_wrapper_internal [inlined] () at :790
#17 0x001d1e42 in start_wrapper (data=0x9c58de0) at threads.c:832
#18 0x00203cfa in thread_start_routine (args=0xe222690) at wthreads.c:287
#19 0x001aeb20 in gc_start_thread (arg=0x9c587f0) at sgen-gc.c:6196
#20 0x9c596ed9 in _pthread_start ()
#21 0x9c59a6de in thread_start ()
Thread 8 (process 65850):
#0  0x97d32876 in __psynch_mutexwait ()
#1  0x9c5956af in pthread_mutex_lock ()
#2  0x073a955e in _WebTryThreadLock ()
#3  0x073a9255 in WebRunLoopLock ()
#4  0x011a99ce in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#5  0x01140670 in __CFRunLoopDoObservers ()
#6  0x0110c665 in __CFRunLoopRun ()
#7  0x0110bdb4 in CFRunLoopRunSpecific ()
#8  0x0110bccb in CFRunLoopRunInMode ()
#9  0x073a9220 in RunWebThread ()
#10 0x9c596ed9 in _pthread_start ()
#11 0x9c59a6de in thread_start ()
Thread 7 (process 65850):
#0  0x97d32bb2 in __semwait_signal ()
#1  0x9c54b7b9 in nanosleep$UNIX2003 ()
#2  0x9c54b558 in usleep$UNIX2003 ()
#3  0x0021c162 in monotouch_pump_gc ()
#4  0x9c596ed9 in _pthread_start ()
#5  0x9c59a6de in thread_start ()
Thread 6 (process 65850):
#0  0x97d32a9a in recvfrom$UNIX2003 ()
#1  0x9c54b4a2 in recv$UNIX2003 ()
#2  0x00227b41 in recv_uninterrupted ()
#3  0x00227c24 in sdb_recv ()
#4  0x000b005a in transport_recv [inlined] () at :1373
#5  0x000b005a in debugger_thread (arg=0x0) at debugger-agent.c:7799
#6  0x00203cfa in thread_start_routine (args=0xe22232c) at wthreads.c:287
#7  0x001aeb20 in gc_start_thread (arg=0x9c632d0) at sgen-gc.c:6196
#8  0x9c596ed9 in _pthread_start ()
#9  0x9c59a6de in thread_start ()
Thread 5 (process 65850):
#0  0x97d30c5e in semaphore_wait_trap ()
#1  0x0020c21a in mono_sem_wait (sem=Cannot access memory at address 0x0
) at mono-semaphore.c:115
#2  0x0011224a in finalizer_thread (unused=0x0) at gc.c:1070
#3  0x001d1e16 in start_wrapper_internal [inlined] () at :784
#4  0x001d1e16 in start_wrapper (data=0xdb72500) at threads.c:832
#5  0x00203cfa in thread_start_routine (args=0xe222234) at wthreads.c:287
#6  0x001aeb20 in gc_start_thread (arg=0xdb72550) at sgen-gc.c:6196
#7  0x9c596ed9 in _pthread_start ()
#8  0x9c59a6de in thread_start ()
Thread 4 (process 65850):
#0  0x97d30c22 in mach_msg_trap ()
#1  0x97d301f6 in mach_msg ()
#2  0x000de64a in mach_exception_thread (arg=0x0) at mini-darwin.c:132
#3  0x9c596ed9 in _pthread_start ()
#4  0x9c59a6de in thread_start ()
Thread 3 (process 65850):
#0  0x97d32a9a in recvfrom$UNIX2003 ()
#1  0x9c54b4a2 in recv$UNIX2003 ()
#2  0x00227b41 in recv_uninterrupted ()
#3  0x0022933b in monotouch_process_connection ()
#4  0x00228a17 in monotouch_connect_wifi ()
#5  0x002278b7 in monotouch_configure_debugging ()
#6  0x0022bd75 in -[CocoaThreadInitializer entryPoint:] ()
#7  0x017374e6 in -[NSThread main] ()
#8  0x01737457 in __NSThread__main__ ()
#9  0x9c596ed9 in _pthread_start ()
#10 0x9c59a6de in thread_start ()
Thread 2 (process 65850):
#0  0x97d3390a in kevent ()
#1  0x03784373 in _dispatch_mgr_invoke ()
#2  0x03782cd0 in _dispatch_mgr_thread ()
Thread 1 (process 65850):
#0  0x947e7d52 in ?? ()
#1  0x90154973 in CGDataProviderRetain ()
#2  0x9c80364a in CFAllocatorCreate ()
#3  0x9859a3d1 in CGImageReadCreateWithProvider ()
#4  0x9859a291 in CGImageSourceCreateWithDataProvider ()
#5  0x013d4d2f in CGImageCreateWithPNGDataProvider ()
#6  0x073de2a5 in WKGraphicsCreateImageFromBundleWithName ()
#7  0x06c305bd in WebCore::GraphicsContext::drawLineForTextChecking ()
#8  0x06d0ae84 in WebCore::InlineTextBox::paintSpellingOrGrammarMarker ()
#9  0x06d0afb9 in WebCore::InlineTextBox::paintDocumentMarkers ()
#10 0x06d073fc in WebCore::InlineTextBox::paint ()
#11 0x06d003cd in WebCore::InlineFlowBox::paint ()
#12 0x0726124c in WebCore::RootInlineBox::paint ()
#13 0x071bce2a in WebCore::RenderLineBoxList::paint ()
#14 0x07156089 in WebCore::RenderBlock::paintObject ()
#15 0x0715648f in WebCore::RenderBlock::paint ()
#16 0x07155615 in WebCore::RenderBlock::paintChildren ()
#17 0x071560ab in WebCore::RenderBlock::paintObject ()
#18 0x0715648f in WebCore::RenderBlock::paint ()
#19 0x071aa1b0 in WebCore::RenderLayer::paintLayer ()
#20 0x071aa48c in WebCore::RenderLayer::paintLayer ()
#21 0x071ab3bb in WebCore::RenderLayer::paint ()
#22 0x06c03809 in WebCore::FrameView::paintContents ()
#23 0x067b91d0 in -[WebFrame(WebInternal) _drawRect:contentsOnly:] ()
#24 0x067e083c in -[WebHTMLView drawSingleRect:] ()
#25 0x067e0786 in -[WebHTMLView drawRect:] ()
#26 0x073a6c2f in drawCallback ()
#27 0x073e152c in _WKViewDraw ()
#28 0x073e161f in _WKViewDraw ()
#29 0x073e161f in _WKViewDraw ()
#30 0x073e161f in _WKViewDraw ()
#31 0x073e161f in _WKViewDraw ()
#32 0x073e180e in WKViewDisplayRect ()
#33 0x073e2ad0 in WKWindowDrawRect ()
#34 0x07371af0 in WebCore::TileCache::drawLayer ()
#35 0x07376af1 in -[TileLayer drawInContext:] ()
#36 0x0418612d in backing_callback ()
#37 0x040a615d in CABackingStoreUpdate_ ()
#38 0x04185fd2 in CA::Layer::display_ ()
#39 0x04173cf1 in -[CALayer _display] ()
#40 0x0417a281 in CA::Layer::display ()
#41 0x04173d17 in -[CALayer display] ()
#42 0x0417dc5c in CA::Layer::display_if_needed ()
#43 0x04103fb9 in CA::Context::commit_transaction ()
#44 0x04105ea6 in CA::Transaction::commit ()
#45 0x04105580 in CA::Transaction::observer_callback ()
#46 0x011a99ce in __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ ()
#47 0x01140670 in __CFRunLoopDoObservers ()
#48 0x0110c4f6 in __CFRunLoopRun ()
#49 0x0110bdb4 in CFRunLoopRunSpecific ()
#50 0x0110bccb in CFRunLoopRunInMode ()
#51 0x0479d879 in GSEventRunModal ()
#52 0x0479d93e in GSEventRun ()
#53 0x021a4a9b in UIApplicationMain ()
#54 0x0e9e018d in ?? ()
#55 0x0e9de930 in ?? ()
#56 0x0e9de608 in ?? ()
#57 0x0e9de77e in ?? ()
#58 0x00010222 in mono_jit_runtime_invoke (method=0xa3031e4, obj=0x0, params=0xbffff1d8, exc=0x0) at mini.c:5797
#59 0x00171f6e in mono_runtime_invoke (method=0xa3031e4, obj=0x0, params=0xbffff1d8, exc=0x0) at object.c:2757
#60 0x00176294 in mono_runtime_exec_main (method=0xa3031e4, args=0xc69be98, exc=0x0) at object.c:3932
#61 0x00176605 in mono_runtime_run_main (method=0xa3031e4, argc=0, argv=0x2dee80, exc=0x0) at object.c:3562
#62 0x0006b7f5 in mono_jit_exec (domain=0x9d616b0, assembly=0x986b2f0, argc=1, argv=0x2dee80) at driver.c:1122
#63 0x0022bcd0 in main ()

有人知道这里会发生什么吗?我现在会尝试隔离这个问题,但我仍然希望有人能给我指明正确的方向。

是。这是iOS模拟器的一个已知错误(与MonoTouch无关)。解决方法是在模拟器中执行时禁用拼写检查(例如#if SIMULATOR)。

UITextField在模拟器中崩溃,而不是在iPhone 4(4.2)中

您可以通过附加gdb并获取所有线程的堆栈跟踪来了解应用程序在做什么:

gdb program <PID printed to application output on startup>
<gdb output>
(gdb) thread apply all backtrace
<more gdb output>

最新更新