我剛剛將我的Monotouch升級到6,現在我的應用程序無法啓動。它以前工作沒有任何問題。現在它在Main.cs文件中引發一個異常(下面列出)。我已經瀏覽了Xamarin的故障排除提示,但並未解決問題。我重新佈置了筆尖文件,刪除並重新配置了我的插座,並創建了一個全新的筆尖,以查看是否可以解決問題。其他人有任何想法嗎?從LoginView.designer.cs非關鍵值編碼兼容(Monotouch和iOS 6)
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
代碼:從Main.cs
[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;
}
}
代碼(其中代碼休息):
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
這裏是我的AppDelegate其中片段我打電話給ViewController:
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;
如果可能,還需要更多代碼。 – fuzz
增加了一些代碼,它只是設計器生成的代碼。但是,它應該讓你瞭解設計師正在同步什麼。正如我所說的,它在升級之前就起作用了所以,我很好奇它是否是一個Monotouch /開發bug。 – jamesbar2