Error showing when i opening my xib file - ios

iam using following code for opening xib when i click tableview row
ViewController *List=[[ViewController alloc]initWithNibName:#"ViewController" bundle:nil];
[self.navigationController pushViewController:List animated:YES];
and iam getting this exception
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)

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:
For regular non-storyboard nibs, select the top-level view to access this option.

You designed the view in IB using auto layout, but you are trying to run the code on an ios5 device or simulator?
EDIT: right, that class does not exist in iOS5! If you want this app to run in iOS5, you need to convert the xib from AutoLayout back to springs and struts. There is a checkbox in each XIB, in the right inspector view, to do this.

Related

Assertion failure with segues

I copied my project and renamed it - I've managed this before without too much incident.
This time I am getting the following error on any segue performed.
*** Assertion failure in -[UIStoryboardSegueTemplate segueWithDestinationViewController:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit_Sim/UIKit-3512.29.5/UIStoryboardSegueTemplate.m:90
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not create a segue of class '(null)''
I've cleaned the project, removed all DerivedData. All segues are correctly named and show on the storyboard. It seems to have nothing to do with main UI threads etc. The segue code worked fine before the conversion.
I'm thinking the solution might be to remove and re-establish every segue but would like to check before I start investigating that.
Thanks.
Try to open the storyboard as 'source code' and search for old project name.
Find this segue in Storyboard,
In Attributes Inspector select your new module (or check Inherit Module From Target)
This fixed it for me..
If you have just renamed your project, check in your Storyboard... Each of your Segues are probably still using the old Module. Click the little drop down and select the new Module...
You can view the module by clicking on the segue and looking at the info in the right panel, just like you would with a button, label etc.

Why the same code goes with different result

I just pull the code of my team. But why it run well with the other simulator, and my device it always goes crash. I also use the xcode 7.2, which is the same as the other, and the code are similar, and run with the same simulator (Iphone6). But when I go to the abcViewController, it goes crash.
It says:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Storyboard (<UIStoryboard: 0x7fb5e2409200>) doesn't contain a view controller with identifier 'StepDetailViewController''
*** First throw call stack:
The problem is not the code, so I don't put it here. Anyone know why this happen?
The error message already includes what's wrong:
'Storyboard (<UIStoryboard: 0x7fb5e2409200>) doesn't contain a view controller with identifier 'StepDetailViewController'
Your storyboard file (probably Main.storyboard) has a UIViewController which doesn't have an identifier. Open the storyboard, click on the UIViewController and enter StepDetailViewController in the Storyboard ID textfield in the identity inspector on the right side of your XCode window.
You have to make sure of following things in Interface Builder:
In the Attribute inspector, make sure your project is selected in the
Module field
In the Identity section of the Attribute Inspector your
Storyboard ID should be 'StepDetailViewController'
If you are using Git, it might be a good idea to check the files are on the .gitignore file, if the above points don't help, your problem is probably in one of the added files.

my xcode 6.1 keep crashing when i resize or pin the view in storyboard

I think its the autolayout thing that keep me crashing?
I tried to add a view in the main view in my project
and when i tried to resize it .or pin it, it just crash
I dont know how to do now..
Application Specific Information:
ProductBuildVersion: 6A1052d
ASSERTION FAILURE in /SourceCache/IDEInterfaceBuilder/IDEInterfaceBuilder-6250/InterfaceBuilderKit/AutoLayout/IBAutolayoutFrameDecider.m:346
D etails: "arbitrationUnit" should not be nil.

NSInvalidUnarchiveOperationException, UIStoryboardShowSegueTemplate

I am using storyboard in which there is UINavigationController. View controllers are popped and pushed.
The issue is , when i push a UIViewController i take the exception on iOS 7, it works fine on iOS 8.
Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named UIStoryboardShowSegueTemplate'
What can be the problem?
Could you please help
As i am also getting the same issue with my project. I get this resolved by rechecking all segues i defined in the app. Make sure all segues will have some action like push/pop/modal.
If not then on that controller app will crash. Please check below snapshot which you will find in your storyboard.
Refer a solution on below link.
"Could not instantiate class named UIStoryboardShowSegueTemplate" - how can I make a Storyboard happy with iOS 7 and iOS 8?

Storyboard crashes Xcode when opened

Whenever I attempt to open up my storyboard, Xcode crashes with the following error report
The funny thing is, the app works fine in the simulator and builds without errors. What is causing this crash? I see two possible crashes:
Exception reason: UITableView dataSource is not set
, but that shouldn't make the storyboard crash right?
Details: Failed to compute auto layout status IBLayoutConstraint, IBUIButton, IBUIDatePicker, IBUITextField, IBUIView, IBUIViewController, and IBUIViewControllerAutolayoutGuide.
Which doesn't give much information at all.
I have been using a storyboard with Xcode 5 for some time, so the question does not appear to be related to moving from Xcode 4 to 5. I can open the storyboard as XML and I can open my iPhone storyboard just fine.
If you are using git, I would recommend reverting to a time before this problem started.
If you are not using git, and you are absolutely sure you did not edit the xml for the storyboard then I would say:
1)find the storyboard file using the finder.
2)copy it to your desktop.
3)go back to Xcode and delete the storyboard from your project, select "move to trash". 4)re-import the storyboard file into your project.
Ive had similar problems with Xcode 5 and either reverting using git or the steps above usually get me back up and running.
Exception reason: UITableView dataSource is not set
Details: Failed to compute auto layout status IBLayoutConstraint, IBUIButton, IBUIDatePicker, IBUITextField, IBUIView, IBUIViewController, and IBUIViewControllerAutolayoutGuide.
The errors described above lead me to think that one if not all viewcontroller(s) for the items listed above lost their connectivity to viewcontroller.h / viewcontroller.m files. I would make sure you have everything wired up correctly, and you can check this by making sure the items in your viewcontroller have a circle in the gutter (next to the line numbers) that is filled in (solid) if the circle is not filled in then it means your items are not wired up to your viewcontroller. I would post a picture of your .h / .m file of your viewcontroller so we can further investigate.
I ended up copying each view controller scene (in XML) into a new storyboard. Some view controllers could not be copied without the storyboard crashing so I had to recreate about 4 of them, but by and large I got the majority of my work back.
What you need to do is reopen the project again in Xcode 5 and then go to the storyboard. Then at the right side choose for "Identity and type" and then set "opens in" to Xcode 4.6 to be able to open it in Xcode 4.6. And disable auto layout, somehow when you open it in xcode 5 it asks you to update it, I think you did that without a thought, happened to me as well :)

Resources