2013-05-10 12 views
0

使用下面的代碼IAM和IAM獲得此異常錯誤顯示當我打開我的XIB文件打開時,我點擊的tableview行</p> <pre><code>ViewController *List=[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil]; [self.navigationController pushViewController:List animated:YES]; </code></pre> <p>廈門國際銀行

Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint' 
*** First throw call stack: 
(0x245e052 0x1731d0a 0x2406a78 0x24069e9 0xbbe7d7 0xbbe9af 0xbbe6b7 0xabf36d 0x966e2c 0x9673a9 0x9675cb 0x967941 0x97947d 0x97966f 0x97993b 0x97a3df 0x97a986 0x97a5a4 0x41b08 0x93171d 0x931952 0x11b986d 0x2432966 0x2432407 0x23957c0 0x2394db4 0x2394ccb 0x391a879 0x391a93e 0x8a1a9b 0x28dd 0x2805) 
terminate called throwing an exception(lldb) 
+0

你在ViewController的viewDidLoad&viewWillAppear方法裏面有什麼? – 2013-05-10 12:48:08

+0

默認代碼是 – user2354159 2013-05-10 12:48:56

回答

1

發生這種情況是因爲您使用的是默認情況下使用「自動佈局」的Xcode 4.5+(或以前的測試版)。自動佈局僅適用於iOS 6,因此您將在以前的iOS版本中看到運行時錯誤。

您可以通過打開你的故事板,打開工具窗格中,並在第一個選項卡/節禁用「使用自動佈局」複選框解決這個問題:

enter image description here

對於常規的非故事板筆尖,選擇訪問此選項的頂級視圖。

+0

iam使用xcode 4.6.2但是自動喚醒ios有.now iam un檢查它,讓我試試 – user2354159 2013-05-10 12:52:38

+0

工作... autolayout是罪魁禍首 – user2354159 2013-05-10 12:53:19

+0

乾杯! 。 。快樂編碼! – 2013-05-10 12:54:20

0

您使用自動設計IB視圖佈局,但你正試圖在ios5設備或模擬器上運行代碼?

編輯:對,該類不存在於iOS5!如果你想讓這個應用程序在iOS5中運行,你需要將xib從AutoLayout轉換回spring和struts。在每個XIB中的右側檢查器視圖中都有一個複選框來執行此操作。

+0

iphone模擬器5.0 – user2354159 2013-05-10 12:51:00

相關問題