我試圖創建一個應用程序,它從一個主頁面上有三個按鈕開始。每按下一個按鈕將切換到另一個視圖。每個視圖都只是一個帶有UIWebView的空白視圖。當沒有任何內容時,轉換到每個頁面都可以正常工作。然而,當我添加了一個UIWebView和所有正確的代碼,頁面轉換導致應用程序與此錯誤消息崩潰:'NSUnknownKeyException'與UIWebview
*終止應用程序由於未捕獲的異常「NSUnknownKeyException」,原因是:「[ setValue:forUndefinedKey:]:這個類不是關鍵的viewWeb編碼兼容的值。' *第一擲調用堆棧: (0x1c94012 0x10d1e7e 0x1d1cfb1 0xb7de41 0xaff5f8 0xaff0e7 0xb29b58 0x233019 0x10e5663 0x1c8f45a 0x231b1c 0xf67e7 0xf6dc8 0xf6ff8 0xf7232 0x259b 0x10e5705 0x192c0 0x19258 0xda021 0xda57f 0xd96e8 0x48cef 0x48f02 0x26d4a 0x18698 0x1befdf9 0x1befad0 0x1c09bf5 0x1c09962 0x1c3abb6 0x1c39f44 0x1c39e1b 0x1bee7e3 0x1bee668 0x15ffc 0x1e92 0x1dc5) 的libC++ abi.dylib:終止叫做拋出異常
我敢肯定所有的UIWebView代碼是正確的,因爲我在測試新的應用完全相同的代碼只運行在一個單一的視圖,並沒有過渡。但這裏是我使用的過渡代碼:
- (IBAction)floorCatalog:(id)sender {
UIViewController* floorLampsViewController = [[UIViewController alloc] initWithNibName:@"floorLampsViewController" bundle:[NSBundle mainBundle]];
[self.view addSubview:floorLampsViewController.view];
}
- (void)dealloc {
[_floorLampsButton release];
[_tableLampsButton release];
[_wallLampsButton release];
[super dealloc];
}
- (void)viewDidUnload {
[self setFloorLampsButton:nil];
[self setTableLampsButton:nil];
[self setWallLampsButton:nil];
[super viewDidUnload];
}
而且這裏是我使用的代碼的網頁訪問量:
@property (retain, nonatomic) IBOutlet UIWebView *viewWeb;
[self.viewWeb loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.bing.com"]]];
任何之所以出現這種情況持續發生?謝謝!
可能的重複[此類不是密鑰的關鍵值編碼兼容](http://stackoverflow.com/questions/3088059/this-class-is-not-key-value-coding-compliant-for -the-key) – jtbandes