App crash on iOS 5 - Could not instantiate class named NSLayoutConstraint - iphone

My app is working very fine on iPhone and Simulator with iOS 6, but when i try to run on iPhone/Simulator with iOS 5 the app crashes
The error is:
Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'
I'm not using Autolayout on Interface Builder Document.
Could anyone help me?
Autolayout is not checked

make sure you have unselected use autolayout in interfacebuild

You've been burned. NSLayoutConstraint only exists on iOS 6. You have to check to see if it's there, and if it's not, you have to do something else.

Related

tvOS 11 update UICollectionView Crash

Any ideas on what could be causing app to crash on back After automatic update to tvOS 11? same version of app on tvos 10 doesnt crash.
*** Assertion failure in -[UICollectionView _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:isFocused:notify:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3698.33.3.301/UICollectionView.m:1964
2017-12-14 15:23:16.113879+0100 UR Play[370:24888] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '**UICollectionView dataSource is not set'.
Make sure that either in your code you implemented dataSource and linked it to your UICollectionView or you can do that using the Storyboard.
The crash was solved by reseting the UICollectionview datasource to nil in deinit
This post helped understand what's going on
https://github.com/ReactiveX/RxSwift/issues/1154

iOS application runs on iPhone but not iPad

I'm trying to run my application on both my iPhone and iPad but whilst the application runs on the iPhone, when I run it on the iPad I get the following error:
Terminating app
due to uncaught exception 'NSUnknownKeyException', reason:
'[ setValue:forUndefinedKey:]: this class
is not key value coding-compliant for the key ipad_switch_view.'
I only have the one ViewController and my iphone and ipad storyboards are the exact same. They both have a single text view and a switch which I've linked both with the same method.
Is there any reason I can't think of why this is happening? I'm still very new to iOS programming.
Check your IBOutlet in your xib or storyboard
For example . You can see in below image.
In above image lblserverDateTime is not exist in outlet .So remove
that type of IBoutlet or add into your class..

how to work UICollectionView in iOS 5

IS it work UICollictionview in IOS 5 error Terminating app due to uncaught exception 'NSInvalidUnarchiveOperationException', reason: 'Could not instantiate class named NSLayoutConstraint'
UICollectionView is not directly available in IOS5.
However there is a nice open source control for adding UICollectionView support in IOS5. Its called PSCollectionView and you can find it here: PSTCollectionView
It is a drop in library that emulates UICollectionView on IOS5 and passes through on IOS6. Very nice and works very well.
best of luck.
Check Availability of UICollectionView
Availability Available in iOS 6.0 and later.
You can go with PSCollectionView
In fact the problem probably isn't due to UICollectionView not being available in iOS5. It looks as though you're using constraints in Interface Builder. It is that that's causing the problem.
So, two things:
Use something like PSTCollectionView to add UICollectionView support in iOS5
Switch off constraints and revert to using "springs and struts" to resize/relocate your subviews

Error After Duplicating Storyboard

Previously i had an existing iphone project.
Afterwards i want to create its iPad version so I duplicated the existing iPhone MainStoryboard to save my time, so I changed the line:
targetRuntime="iOS.CocoaTouch"
from the new storyboard (named MainStoryboard_iPad) to:
targetRuntime="iOS.CocoaTouch.iPad".
Finally I set Main Storyboard in iPad Development info to "MainStoryboard_iPad. But I don''t know why some how i got this error:
2012-10-11 13:28:07.852 CollViewSmpl[3170:c07] * Assertion failure in -[PSUICollectionView _dequeueReusableViewOfKind:withIdentifier:forIndexPath:], /SourceCache/UIKit_Sim/UIKit-2372/UICollectionView.m:2249
2012-10-11 13:28:07.878 CollViewSmpl[3170:c07] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'could not dequeue a view of kind: UICollectionElementKindCell with identifier cellID - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
Anyone know what could cause this error and give me some workarounds? FYI, I use open source PSUICollectionView library inside the project in place of UICollectionView
That inconsistence error is because the storyboard source code were not being saved properly. Finally i created a new storyboard document targeted for iPad. I copied all source code of the preexisting iPhone storyboard and pasted them into the new one. I didn't forget to save the document (this is important) and gotcha, all the stuffs are now working very well.

Works on simulator, but doesn't work on Iphone

I developed an application that runs fine on the Simulator, but crashes on the iPhone.
Actually, the app doesn't crash on initialization, but when I change to another view.
I realized, the application just crash when i change to a view that doesn't have a Segue. For instance, on executing
[self.navigationController pushViewController:detailViewController animated:YES];
The crash is:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Could not find a storyboard named 'MainStoryBoard' in bundle NSBundle </var/mobile/Applications/EE37B62E-E345-4F69-A6F0-3F56CB23F7BF/tableview.app> (loaded)'
First throw call stack:
(0x357d788f 0x37b7e259 0x335835fb 0x1ccad 0x332bd93d 0x33337627 0x352f1933 0x357aba33 0x357ab699 0x357aa26f 0x3572d4a5 0x3572d36d 0x373c9439 0x33239cd5 0x9a25 0x99c0)
terminate called throwing an exception(lldb)
Difficult to say for certain, but the fact that the filename is 'MainStoryBoard' (with capital B) makes this sound like a case sensitivity issue. The Mac (and therefore the Simulator) is not case sensitive, but the iPhone itself is, meaning incorrect case sensitivity runs fine until you put it on an actual device. Run a project-wide search for MainStoryboard and make sure the filename and any references to it in code match up perfectly.