Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fix NSInvalidUnarchiveOperationException

* Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: '* -[NSKeyedUnarchiver decodeObjectForKey:]: cannot decode object of class (NSLayoutConstraint)'

I have a very simple app

One view has one button

I Control Click and dragged the button to a second view and selected MODAL

When I run it in the simulator, everything works

When i run it in my iPad running iOS 5.1.1, it crashes with the error above. I have no idea why and there is no code.

like image 751
Cocoa Dev Avatar asked Jun 18 '12 15:06

Cocoa Dev


2 Answers

This is occuring because you are using Xcode 4.5 (or previously the beta) which uses "auto layout" by default. Auto layout is only available on iOS 6 so you will get a runtime error on previous iOS versions.

You can fix this by opening your Storyboard, opening the Utilities pane, and disabling the "Use Autolayout" checkbox in the first tab/section:

enter image description here

For regular non-storyboard nibs, select the top-level view to access this option.

like image 176
Mike Weller Avatar answered Nov 04 '22 11:11

Mike Weller


In Your Xib-> Identity and type ->Interface Builder Document -> uncheck useAutoLayout check box,this is the new feature with Ios6

like image 41
Appsunic Avatar answered Nov 04 '22 10:11

Appsunic