ios - 运行 Storyboard 项目时,符合 Monotouch 键值编码标准的崩溃

标签 ios xcode xamarin.ios xamarin xamarin-studio

在向 Storyboard添加一个简单的按钮或组件,然后运行调试后,我收到一条消息,指出存在键值编码问题。如果我清理解决方案,它的构建就可以,但是如果我添加另一个组件,我会再次遇到相同的错误。

enter image description here

最佳答案

看到问题后编辑

问题似乎出现在 Xamarin Studio 上 - 这里是 bug report #15002在 Xamarin 的 Bugzilla 上。我会添加 github repository与示例重现问题。它只发生在设备上,而不发生在模拟器上。


旧答案

将正在运行的实例附加到 AppDelegate 时会出现问题。您的 AppDelegate.cs 文件可能有一个未注册的类。尝试验证您的文件内容是否与此类似:

特别是这部分:

    [Register ("AppDelegate")]
    public partial class AppDelegate : UIApplicationDelegate

完整文件:

using System;
using System.Collections.Generic;
using System.Linq;
using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace StoryBoardTables
{
    // The UIApplicationDelegate for the application. This class is responsible for launching the
    // User Interface of the application, as well as listening (and optionally responding) to
    // application events from iOS.
    [Register ("AppDelegate")]
    public partial class AppDelegate : UIApplicationDelegate
    {
        // class-level declarations
        UIWindow window;
        PaintCodeViewController viewController;
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            viewController = new PaintCodeViewController ();
            window.RootViewController = viewController;
            window.MakeKeyAndVisible ();

            return true;
        }
    }
}

关于ios - 运行 Storyboard 项目时,符合 Monotouch 键值编码标准的崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21256818/

相关文章:

ios - 如何将项目追加到表格或 Collection View 的底部?

ios - NSOperationQueue 在响应 iOS 上再次运行相同的任务

ios - 无法调用非函数类型的值 '((AnyClass) -> Bool)!'

iphone - 将图像命名为导航栏名称

ios - 如何在 Xamarin Studio 中检查预构建事件的构建配置

xamarin - 配对 mac 错误无法执行 'grep "ssh-rsa ...."

ios - 如何检测不规则形状的边界?

xcode - Xcode无法识别C++语法

c# - 我是否必须在 MonoTouch 的 UITableViewSource 中保留对 GetCell() 和 GetViewForHeader() 的返回值的显式引用?

swift - MacOS - 如何以编程方式将 ImageView 彼此相邻放置?