Xcode 4.5 corrupting XIBs?

北城余情 提交于 2019-11-28 17:11:27

Uncheck the "use Autolayout" highlighted in the below image. Xcode 4.5 enables this property by default for the new nib files you add into your project. Unchecking the autolayout check box solved the problem

I had this same issue and fixed it by unchecking the 'Use Autolayout' checkbox on the Document Inspector pane in Utilities.

I just had this problem and tracked it down to a UIButton that had the Title field set to Attributed in the Attributes Inspector. Changing this to Plain fixed the problem. If I remember correctly I added this button in the last version of Xcode and had trouble with it then also.

For me it was a combination of the comment by Jason Coco and the answer by tomgerhardt: My app targets iOS5, I upgraded to Xcode 4.5 and created a new NIB. By default this targeted iOS6, causing a crash. I set this to iOS5 in the NIB's file inspector window.

Then I got a compiler error that told me Use Autolayout wasn't supported for iOS5, turned that of in the Document inspector and my issue was fixed.

I am using Xcode 4.5 and iPhone simulator 5.0 and it this same error when the first Table was displayed. Following the 'uncheck autolayout' advice, I got it working by Switching the Document Versioning to iOS 5.0. (Storyboard selected -> File Identify tab -> Interface Builder Document -> Document Versioning.) The AutoLayout was already unselected.

So, after about an hour of trying to figure this out, I figured out the issue. It is indeed what is described above: make sure your .xib is set to the same target version (in this case, most likely < 6.0) as what your main app was written for, and uncheck "Use Autolayout" in the options for this particular .xib.

The reason it will work in the simulator, is because your simulator actually is running iOS6. When trying to use a device with an older iOS, will result in this error. My problem was, I was creating a custom TableViewCell which by default was targeted for iOS 6 and had the "Use Autolayout" checked. This was the culprit for me.

Hopefully I'm able to save someone out there the grief I was put through with this error!

After disabling Auto-Layout for all my .xib files I still had the error. This was due to the fact I used Text -> Attributed for a UILabel in a .xib file.

After setting it to Plain the error was gone.

The name after "loadNibNamed:" must be the name of the nib file (in project navigator on the left side of the screen), sometimes people write there 'cell identifier' that writes from the start in CellForRowAtIndexPath (static NSString ...).

May be your problem in this little fault?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!