Why the same code goes with different result - ios

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.

Related

App crashes in AppDelegate and cannot get past launch screen

The app crashes in AppDelegate, unable to get beyond the launch screen. No view controller code ever gets executed.
The stack trace is also not very helpful nor is the line highlighted in AppDelegate when the crash occurs.
Images below provide the details.
How to debug from here?
Check any IBOutlet links carefully; you may have deleted the property from your view controller but the UI element is still connected to it. This should give you an exception stating something like Class ViewController is not key value coding-compliant for key XXX where XXX is your bad IBOutlet, however Swift's exception reporting does seem to be a bit hit-and-miss at times.
Here's another possible cause related to the reason Paulw11 stated that may help someone else.
If you have segue's in your storyboard that links to a storyboard reference in another bundle, and you change the name of the bundle where the reference resides, make sure to update the Bundle name in your storyboard for the linked reference.
I have a framework I'm developing that contains some storyboards and UI components. I decided to rename the framework, updated the podfile references in the app and all the file imports to reflect the new framework name but completely forgot that there were storyboard references in the app referencing view controllers provided in storyboards in the framework.
Here's an example:
If you do not rename the reference you will experience a crash when you try to load the storyboard containing your link with no hint as to why. I spent an embarrassing amount of time hunting this down.

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.

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?

Unable to resolve 'Class is not key value coding-compliant'

I created a class with XIB file and an UILabel in it, using Interface Builder. The UILabel was linked with an IBOutlet in the corresponding .h class.
I deleted the XIB file, but I now get the following error message upon execution:
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<ChildViewController 0x91d9340> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key <IBOutletName for Label>.'
I tried to clean the project, delete all references to this IBOutletName in the project, tried to find this name with Grep in the code, but still have the issue. Any idea where I can find this name and delete it ?Thanks !
To find where the name is used, first type the outlet back into the code. If Xcode determines that there is a connection for that outlet, it will fill in the circle in the left margin. Click on the circle, and you should see something like this
For future reference, you should always delete all connections in the xib or storyboard, before deleting the corresponding IBOutlets/IBActions from the code. To do this,
open the xib
select the File's Owner
open the Connections inspector
delete all the connections
Then go to the source code, and verify that none of the corresponding IBOutlets/IBActions have filled circles in the left margin.
If the problem persists, it may help to delete the build directory, and delete the app from the device.
To delete the build directory
open Xcode (but don't open the project)
in the Window menu, select Organizer
select Projects at the top of the organizer window
right click on the project name in the list at the left
select Remove from Organizer... from the popup menu
click Delete
It seems that there is maybe some bug that occurs sometimes. For me nothing helped because I had everything right in xib, but after I clean and uninstalled app from device everything worked again. So don't know if clean or uninstall but both helped.

Error showing when i opening my xib file

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.

Resources