应用程序在iOS模拟器中运行正常,在设备上崩溃

时间:2011-04-16 01:57:30

标签: xamarin.ios monodevelop

我的monotouch iPhone / iPod应用程序(名为Assement)在iOS模拟器中运行正常,没有警告,也没有任何错误。但是,当我将其部署到设备时,它会在启动时立即崩溃。

我看了一下崩溃转储(完整的.crash文件可以是downloaded here),但它看起来甚至看起来都没有得到Application.Main():

14  Assessment                      0x002a0ffc mono_handle_exception (mini-exceptions.c:1831)
15  Assessment                      0x002c64cc mono_arm_throw_exception (exceptions-arm.c:158)
16  Assessment                      0x00197cc4 throw_exception + 4018  CoreFoundation                   0x000a4daa __handleUncaughtException + 206
  -->  17  Assessment                       0x003fda68 monotouch_exception_handler (monotouch-glue.m:834)
  -->  18  CoreFoundation                   0x000a4daa __handleUncaughtException + 206
19  libobjc.A.dylib                 0x000088cc _objc_terminate + 148
20  libstdc++.6.dylib               0x00063100 __cxxabiv1::__terminate(void (*)()) + 76
21  libstdc++.6.dylib               0x00063178 std::terminate() + 16
22  libstdc++.6.dylib               0x000632a0 __cxa_throw + 100
23  libobjc.A.dylib                 0x00006f28 objc_exception_throw + 104
24  CoreFoundation                  0x000a4abc +[NSException raise:format:arguments:] + 64
25  CoreFoundation                  0x000a4af0 +[NSException raise:format:] + 24
26  UIKit                           0x00290af8 -[UINib instantiateWithOwner:options:] + 1724
27  UIKit                           0x00292638 -[NSBundle(UINSBundleAdditions) loadNibNamed:owner:options:] + 132
28  UIKit                           0x00051b10 -[UIApplication _loadMainNibFile] + 136
29  UIKit                           0x0004b9e4 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 248
30  UIKit                           0x000052dc -[UIApplication handleEvent:withNewEvent:] + 1468
31  UIKit                           0x00004b14 -[UIApplication sendEvent:] + 60
32  UIKit                           0x000043ac _UIApplicationHandleEvent + 6816
33  GraphicsServices                0x00005c80 PurpleEventCallback + 1040
34  CoreFoundation                  0x000365c4 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 22
35  CoreFoundation                  0x00036582 __CFRunLoopDoSource1 + 158
36  CoreFoundation                  0x0002882e __CFRunLoopRun + 574
37  CoreFoundation                  0x00028504 CFRunLoopRunSpecific + 220
38  CoreFoundation                  0x00028412 CFRunLoopRunInMode + 54
 --> 39  UIKit                          0x0004a54c -[UIApplication _run] + 540
 --> 40  UIKit                          0x00047550 UIApplicationMain + 964
 --> 41  Assessment                     0x00024bcc wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 232
 --> 42  Assessment                     0x001e9420 X2_AssessmentApp_Application_Main_string__ + 144
43  Assessment                      0x001673f8 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 192

Application.Main是创建项目时生成的标准项(下面的代码都不起作用,名称空间限定的注释版本具有相同的结果):

namespace XXXXXX.App //anonymized
{
public class Application
{
    static void Main (string[] args)
    {
        //UIApplication.Main(args, null, "XXXXXX.App.AppDelegate");
        UIApplication.Main(args, null, "AppDelegate");
    }
}
// The name AppDelegate is referenced in the MainWindow.xib file.
public partial class AppDelegate : UIApplicationDelegate
{
   // This method is invoked when the application has loaded its UI and its ready to run
    public override bool FinishedLaunching (UIApplication app, NSDictionary options)
    {
        System.Console.WriteLine("Finished Launching"); ...

我是否认为在加载主笔尖时失败了?那只是简单的MainWindow.xib,再次开箱即用,因为我在UIApplicationDelegate.FinishedLaunching()方法中做的第一件事就是加载我自己的viewcontroller并查看...我几乎可以期待可能存在该代码中的错误,但它甚至没有那么远。

环境:

  • MonoTouch Professional 3.2.6
  • MonoDevelop 2.4.2发行版20402004
  • iPod Touch 2nd Gen(4.2.1)

有人有什么想法吗?

1 个答案:

答案 0 :(得分:0)

Goeff引导我找到正确的答案。

我以某种方式将MainWindow.xib构建操作从页面更改为内容....完全是用户错误。

设备的控制台日志清楚地说明了问题(与崩溃转储不同):

<Notice>: Unhandled Exception: MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSInternalInconsistencyException Reason: Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/11DD588C-E16C-499D-AE0C-E56F59D90391/Assessment.app> (loaded)' with name 'MainWindow'