MonoTouch 应用程序在模拟器中运行,但不在设备上运行
我知道有很多很多具有相同标题的问题,但它们似乎都截然不同。尽管如此,标题描述了主要症状。
我有一个 MonoTouch 应用程序,它在模拟器中运行得非常好。甚至设备配置和应用程序签名过程也非常顺利。
然而,当应用程序在设备上运行时,它会立即崩溃。 我可以看到它在 Application.cs
中崩溃(在 UIApplication.Main(...)
行中):
using System;
using MonoTouch.UIKit;
namespace MyApp
{
public class Application
{
public static void Main (string[] args)
{
try
{
UIApplication.Main (args, null, "AppDelegate"); //CRASHES HERE!
}
catch (Exception e)
{
Console.WriteLine (e.ToString ());
}
}
}
}
catch outout 声明了一些通用内容:< code>System.NullReferenceException: 未将对象引用设置为对象的实例
崩溃报告如下:
Application Specific Information:
com.testing.game failed to launch in time
Elapsed total CPU time (seconds): 3.140 (user 3.140, system 0.000), 16% CPU
Elapsed application CPU time (seconds): 1.616, 8% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x321de068 __psynch_cvwait + 24
1 libsystem_c.dylib 0x36696f2e _pthread_cond_wait + 634
2 libsystem_c.dylib 0x36696caa pthread_cond_wait + 34
3 GameB 0x007b8954 suspend_current (debugger-agent.c:2375)
4 GameB 0x007bad30 process_event (debugger-agent.c:3013)
5 GameB 0x007bd69c process_breakpoint_inner (debugger-agent.c:3837)
6 GameB 0x007bd7f4 process_breakpoint (debugger-agent.c:3855)
7 ??? 0x014fdff8 0 + 22011896
8 GameB 0x004e3858 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr (mscorlib.dll.6.s:148399)
9 GameB 0x0077d7dc mono_jit_runtime_invoke (mini.c:5784)
10 GameB 0x00890eb0 mono_runtime_invoke (object.c:2757)
11 GameB 0x008940d0 mono_runtime_exec_main (object.c:3940)
12 GameB 0x0089309c mono_runtime_run_main (object.c:3562)
13 GameB 0x00788748 mono_jit_exec (driver.c:1102)
14 GameB 0x0077371c main (main.m:2505)
15 GameB 0x0006c978 start + 44
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x321ce3b4 kevent + 24
1 libdispatch.dylib 0x32922e78 _dispatch_mgr_invoke + 708
2 libdispatch.dylib 0x32922b96 _dispatch_mgr_thread + 30
Thread 2:
0 libsystem_kernel.dylib 0x321de470 __recvfrom + 20
1 libsystem_c.dylib 0x36693aa0 recv + 16
2 GameB 0x007b55c4 recv_length (debugger-agent.c:996)
3 GameB 0x007c8bfc debugger_thread (debugger-agent.c:7136)
4 GameB 0x009030d4 thread_start_routine (wthreads.c:287)
5 GameB 0x00943dc8 GC_start_routine (pthread_support.c:1468)
6 libsystem_c.dylib 0x36696c16 _pthread_start + 314
7 libsystem_c.dylib 0x36696ad0 thread_start + 0
Thread 3:
0 libsystem_kernel.dylib 0x321ce060 semaphore_wait_trap + 8
1 GameB 0x009152e8 mono_sem_wait (mono-semaphore.c:115)
2 GameB 0x0081d648 finalizer_thread (gc.c:1070)
3 GameB 0x008cec40 start_wrapper_internal (threads.c:783)
4 GameB 0x008ced48 start_wrapper (threads.c:831)
5 GameB 0x009030d4 thread_start_routine (wthreads.c:287)
6 GameB 0x00943dc8 GC_start_routine (pthread_support.c:1468)
7 libsystem_c.dylib 0x36696c16 _pthread_start + 314
8 libsystem_c.dylib 0x36696ad0 thread_start + 0
Thread 4 name: WebThread
Thread 4:
0 libsystem_kernel.dylib 0x321ce010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x321ce206 mach_msg + 50
2 CoreFoundation 0x30ecd41c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x30ecc154 __CFRunLoopRun + 876
4 CoreFoundation 0x30e4f4d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x30e4f39e CFRunLoopRunInMode + 98
6 WebCore 0x376e3128 _ZL12RunWebThreadPv + 396
7 libsystem_c.dylib 0x36696c16 _pthread_start + 314
8 libsystem_c.dylib 0x36696ad0 thread_start + 0
Unknown thread crashed with unknown flavor: 5, state_count: 1
任何人都可以看出为什么这可能会崩溃吗??? 我完全不知所措...
干杯, 布雷特
I know there are a lot of SO questions with this same title, but they all appear to be quite different. Nevertheless, the title describes the main symptom.
I have a MonoTouch application which works fantastic in the simulator. Even the device provisioning and app signing process went very smoothly.
However, when the application runs on the device, it crashes instantly.
I'm able to see that it crashes in Application.cs
(in the line UIApplication.Main(...)
):
using System;
using MonoTouch.UIKit;
namespace MyApp
{
public class Application
{
public static void Main (string[] args)
{
try
{
UIApplication.Main (args, null, "AppDelegate"); //CRASHES HERE!
}
catch (Exception e)
{
Console.WriteLine (e.ToString ());
}
}
}
}
With the catch outout stating something generic: System.NullReferenceException: Object reference not set to an instance of an object
The crash report is as follows:
Application Specific Information:
com.testing.game failed to launch in time
Elapsed total CPU time (seconds): 3.140 (user 3.140, system 0.000), 16% CPU
Elapsed application CPU time (seconds): 1.616, 8% CPU
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0:
0 libsystem_kernel.dylib 0x321de068 __psynch_cvwait + 24
1 libsystem_c.dylib 0x36696f2e _pthread_cond_wait + 634
2 libsystem_c.dylib 0x36696caa pthread_cond_wait + 34
3 GameB 0x007b8954 suspend_current (debugger-agent.c:2375)
4 GameB 0x007bad30 process_event (debugger-agent.c:3013)
5 GameB 0x007bd69c process_breakpoint_inner (debugger-agent.c:3837)
6 GameB 0x007bd7f4 process_breakpoint (debugger-agent.c:3855)
7 ??? 0x014fdff8 0 + 22011896
8 GameB 0x004e3858 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr (mscorlib.dll.6.s:148399)
9 GameB 0x0077d7dc mono_jit_runtime_invoke (mini.c:5784)
10 GameB 0x00890eb0 mono_runtime_invoke (object.c:2757)
11 GameB 0x008940d0 mono_runtime_exec_main (object.c:3940)
12 GameB 0x0089309c mono_runtime_run_main (object.c:3562)
13 GameB 0x00788748 mono_jit_exec (driver.c:1102)
14 GameB 0x0077371c main (main.m:2505)
15 GameB 0x0006c978 start + 44
Thread 1 name: Dispatch queue: com.apple.libdispatch-manager
Thread 1:
0 libsystem_kernel.dylib 0x321ce3b4 kevent + 24
1 libdispatch.dylib 0x32922e78 _dispatch_mgr_invoke + 708
2 libdispatch.dylib 0x32922b96 _dispatch_mgr_thread + 30
Thread 2:
0 libsystem_kernel.dylib 0x321de470 __recvfrom + 20
1 libsystem_c.dylib 0x36693aa0 recv + 16
2 GameB 0x007b55c4 recv_length (debugger-agent.c:996)
3 GameB 0x007c8bfc debugger_thread (debugger-agent.c:7136)
4 GameB 0x009030d4 thread_start_routine (wthreads.c:287)
5 GameB 0x00943dc8 GC_start_routine (pthread_support.c:1468)
6 libsystem_c.dylib 0x36696c16 _pthread_start + 314
7 libsystem_c.dylib 0x36696ad0 thread_start + 0
Thread 3:
0 libsystem_kernel.dylib 0x321ce060 semaphore_wait_trap + 8
1 GameB 0x009152e8 mono_sem_wait (mono-semaphore.c:115)
2 GameB 0x0081d648 finalizer_thread (gc.c:1070)
3 GameB 0x008cec40 start_wrapper_internal (threads.c:783)
4 GameB 0x008ced48 start_wrapper (threads.c:831)
5 GameB 0x009030d4 thread_start_routine (wthreads.c:287)
6 GameB 0x00943dc8 GC_start_routine (pthread_support.c:1468)
7 libsystem_c.dylib 0x36696c16 _pthread_start + 314
8 libsystem_c.dylib 0x36696ad0 thread_start + 0
Thread 4 name: WebThread
Thread 4:
0 libsystem_kernel.dylib 0x321ce010 mach_msg_trap + 20
1 libsystem_kernel.dylib 0x321ce206 mach_msg + 50
2 CoreFoundation 0x30ecd41c __CFRunLoopServiceMachPort + 120
3 CoreFoundation 0x30ecc154 __CFRunLoopRun + 876
4 CoreFoundation 0x30e4f4d6 CFRunLoopRunSpecific + 294
5 CoreFoundation 0x30e4f39e CFRunLoopRunInMode + 98
6 WebCore 0x376e3128 _ZL12RunWebThreadPv + 396
7 libsystem_c.dylib 0x36696c16 _pthread_start + 314
8 libsystem_c.dylib 0x36696ad0 thread_start + 0
Unknown thread crashed with unknown flavor: 5, state_count: 1
Can anyone see why this may be crashing???
I'm at a total loss...
Cheers,
Brett
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
崩溃报告看起来与您的问题无关。
以上表示 iOS 看门狗杀死了应用程序,因为启动时间太长(大约 15 秒)。
堆栈跟踪表明您正在等待断点。如果这种情况发生在之前
FinishedLaunching
返回,那么这可能就是看门狗杀死您的应用程序(以及崩溃报告包含的内容)的原因。再次确保您的额外 mtouch 参数在 iPhoneSimulator|Debug 和 iPhone|Debug 之间是相同的。如果仍然崩溃,则从
终端窗口运行并重新崩溃您的应用程序。将输出复制/粘贴到您的问题中。请注意,您应该尝试使用调试和发布,因为我怀疑后者更冗长。
The crash report looks unrelated to your issue.
The above means the iOS watchdog killed the application because it took too much time to start (around 15 seconds).
The stacktrace suggest you were waiting on a breakpoint. If this occurs before
FinishedLaunching
returns then this is likely the reason why the watchdog is killing your app (and what the crash report contains).Again make sure your extra mtouch arguments are identical between iPhoneSimulator|Debug and iPhone|Debug. If this still crash then run
from a terminal window and re-crash your application. Copy/paste the output into your question. Note that you should try it with both Debug and Release since I suspect the later is more verbose.