首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >不符合键值编码(单点触控和iOS 6)

不符合键值编码(单点触控和iOS 6)
EN

Stack Overflow用户
提问于 2012-09-25 07:42:46
回答 4查看 6K关注 0票数 17

我刚刚把我的Monotouch升级到了6,现在我的应用不能启动了。它以前是工作的,没有任何问题。现在,它在Main.cs文件中抛出一个异常(如下所示)。我已经查看了Xamarin上的故障排除提示,但它没有解决问题。我已经重新布置了nib文件,删除并重新配置了我的outlets,并创建了一个全新的nib,看看这是否可以解决这个问题。还有其他人有什么想法吗?

代码语言:javascript
运行
复制
MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown.  Name: NSUnknownKeyException Reason: [<UIApplication 0xc84bb10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key btnNewAccount.
   at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
   at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x0004c] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:38
   at Pokr.Application.Main (System.String[] args) [0x00000] in /Users/James/Projects/App/Main.cs:17

来自LoginView.designer.cs的代码:

代码语言:javascript
运行
复制
[Register ("LoginView")]
partial class LoginView
{
    [Outlet]
    MonoTouch.UIKit.UIImageView imgLogo { get; set; }

    [Outlet]
    MonoTouch.UIKit.UITextField txtEmail { get; set; }

    [Outlet]
    MonoTouch.UIKit.UITextField txtPassword { get; set; }

    [Outlet]
    MonoTouch.UIKit.UIButton btnLogin { get; set; }

    [Outlet]
    MonoTouch.UIKit.UIButton btnNewAccount { get; set; }

    [Outlet]
    MonoTouch.UIKit.UILabel lblSecurityNotice { get; set; }

    [Outlet]
    MonoTouch.UIKit.UIImageView imgKeyboardBorder { get; set; }

    void ReleaseDesignerOutlets ()
    {
        if (imgLogo != null) {
            imgLogo.Dispose ();
            imgLogo = null;
        }

        if (txtEmail != null) {
            txtEmail.Dispose ();
            txtEmail = null;
        }

        if (txtPassword != null) {
            txtPassword.Dispose ();
            txtPassword = null;
        }

        if (btnLogin != null) {
            btnLogin.Dispose ();
            btnLogin = null;
        }

        if (btnNewAccount != null) {
            btnNewAccount.Dispose ();
            btnNewAccount = null;
        }

        if (lblSecurityNotice != null) {
            lblSecurityNotice.Dispose ();
            lblSecurityNotice = null;
        }

        if (imgKeyboardBorder != null) {
            imgKeyboardBorder.Dispose ();
            imgKeyboardBorder = null;
        }
    }

来自Main.cs的代码(代码中断的地方):

代码语言:javascript
运行
复制
    static void Main (string[] args)
    {
        UIApplication.Main (args, null, "AppDelegate");
    }

下面是我调用ViewController的AppDelegate中的代码片段:

代码语言:javascript
运行
复制
        var rootNavigationController = new UINavigationController();

        LoginView loginScreen = new LoginView();
        rootNavigationController.PushViewController(loginScreen, false);

        this.window.RootViewController = rootNavigationController;

        //blank function fires so the getter will init the singleton.
        Singleton.Instance.Initialize();

        // make the window visible
        window.MakeKeyAndVisible ();


        return true;
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12574444

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档