天天看點

Iphone開發Interface Builder出現Assertion Failure錯誤

用Interface Builder打開一個xib檔案時出現了Assertion Failure錯誤,如下圖所示。

<a href="http://blog.51cto.com/attachment/201105/220539137.png" target="_blank"></a>

奇怪,第一次遇到這樣的錯誤,這會導緻xib檔案不能打開,界面設計暫時無法再Interface Builder中進行。

錯誤檢查中,很長時間過去了,還是沒有發現錯誤的原因。

試着打開其他項目的xib檔案,則不會出現這樣的錯誤,說明肯定是該xib檔案又錯誤或者Interface Builder的bug。

突然想起再xib中使用了一個以前很少使用的屬性,再一個标簽欄的itme中使用了badge屬性,如下圖所示。

<a href="http://blog.51cto.com/attachment/201105/221411994.png" target="_blank"></a>

該屬性的作用如下圖所示:

<a href="http://blog.51cto.com/attachment/201105/221528147.png" target="_blank"></a>

于是用Dashcode以xml檔案的方式打開該xib檔案,從其中删除該屬性部分,如下圖:

<a href="http://blog.51cto.com/attachment/201105/221650172.png" target="_blank"></a>

删除這一行,儲存,在此用ib打開,剛才的錯誤沒了,又反複測試幾次,發現的确是該值導緻了該錯誤,還有什麼說的呢.....

本文轉自 yarin 51CTO部落格,原文連結:http://blog.51cto.com/yarin/565632,如需轉載請自行聯系原作者