Tôi vừa nâng cấp Monotouch lên 6 và bây giờ ứng dụng của tôi sẽ không bắt đầu. Nó đã được làm việc trước đây mà không có bất kỳ vấn đề. Bây giờ nó ném một ngoại lệ (được liệt kê dưới đây) trong tập tin Main.cs. Tôi đã xem qua các mẹo khắc phục sự cố trên Xamarin, nhưng nó không giải quyết được vấn đề. Tôi đã sắp xếp lại tệp nib, xóa và định cấu hình lại các cửa hàng của mình và tạo một ngòi ngách hoàn toàn mới để xem liệu điều đó có khắc phục được sự cố không. Có ai khác có suy nghĩ gì không?Not Key Value Coding Compliant (Monotouch và 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
Mã từ LoginView.designer.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;
}
}
Mã từ Main.cs (nơi nghỉ code):
static void Main (string[] args)
{
UIApplication.Main (args, null, "AppDelegate");
}
Dưới đây là đoạn mã từ appdelegate của tôi ở đâu Tôi gọi cho 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;
Cần thêm mã nếu có thể. – fuzz
Đã thêm một số mã cho, đó chỉ là mã do nhà thiết kế tạo ra. Tuy nhiên, nó sẽ cung cấp cho bạn một ý tưởng về những gì nhà thiết kế đang đồng bộ hóa. Như tôi đã nói, nó hoạt động trước khi nâng cấp. Vì vậy, tôi tò mò nếu đó là một lỗi Monotouch/phát triển. – jamesbar2