Terminating app due to uncaught exception [UIImageView _isResizable] - ios

I'm getting an exception:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImageView _isResizable]: unrecognized selector sent to instance 0x7fe01fd0d470'
I just assigned an image to the imageView inside a custom cell using storyboard.
The code is clean. It doesn't have any warnings or errors.

Two reason of this error.
If you want to assign image write.
cell.image=[UIImage imagenamed:#"Name of your image "];
and another reason of this error is you can cut the link of imageView to the outlet.
Again make a new outlet and then check now imageView is working.
i think this will help u.

there may be two or more outlet references to one imageView which makes ambiguous

Please see once the name of image in swift file and StroryBoard. Compare them they must be same.
Also check the identifier of Cell.

Related

I can't solve "invalid nib registered for identifier (BNRItemCell)"

Going through the Big Nerd Ranch iOS book, and I'm on day 2 of trying to solve this and I'm going crazy - can anyone help?
I get the following error message:
2014-06-20 11:37:18.764 Homepwner[10388:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'invalid nib registered for identifier (BNRItemCell) - nib must contain exactly one top level object which must be a UITableViewCell instance'
I've hooked up the BNRItemCell.xib to the corresponding class. Things fail after line 57 where the breakpoint is:
=======================================================
=======================================================
I know that it's gonna be something so basic that I'll kick myself.
Any help will be appreciated thanks!
Observing the TreeView on the left of the IB you have a UIView ( second top level element! ) below the UITableViewCell. Delete it and you should be fine!
I had this same issue. It turns out I had added another view by mistake on the .xib file

Getting 'NSUnknownKeyException' after deleting a control and the corresponding outlet in the code

I am writing a very simple app with just one view controller. However I am getting an exception:
Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key
Here is what I did:
added a UIImageView and created an outlet in the code by ctrl-dragging to the assistant editor.
deleted the UIImageView cause I don't need
deleted the outlet property from the code
checked the connection inspector and removed the outlet from the storyboard/InterfaceBuilder.
But I am still getting the exception as listed above, could anyone give me some hints?
Usually you should do a clean of your project, found in the Project menu next to build That way xib files get recreated and often such errors disappear.

Error when moving view Controller

I get an error saying
*** Assertion failure in -[HatsViewController loadView], /SourceCache/UIKit/UIKit-2380.17/UICollectionViewController.m:104
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UICollectionViewController loadView] loaded the "FCD-ki-UFO-view-1vb-8P-s3C" nib but didn't get a UICollectionView.'
*** First throw call stack:
(0x3467c2a3 0x3c36097f 0x3467c15d 0x34f51ab7 0x368aaa95 0x364a346d 0x3652f353 0x36570d11 0x3656ffe7 0x366923ef 0x3656f0c5 0x3656f077 0x3656f055 0x3656e90b 0x3656ee01 0x364975f1 0x36484801 0x3648411b 0x3818b5a3 0x3818b1d3 0x34651173 0x34651117 0x3464ff99 0x345c2ebd 0x345c2d49 0x3818a2eb 0x364d8301 0xc0dfd 0x3c797b20)
libc++abi.dylib: terminate called throwing an exception
(lldb)
Why does this happen and how can I fix it?
When you’re using a UICollectionViewController, the view outlet needs to be connected to a UICollectionView in your storyboard; if it’s a UIView of another class, it’ll crash.
check HatsViewController.h is inherited from UICollectionViewController but you have connected it view in your storyboard. Either it must be subclass of UIViewController or it is connected to UICollectionView in your storyboard.

How to fix error [<UIViewController 0x752f5a0> setValue:forUndefinedKey:]

I'm new to IOS and I'm stuck with an error I added a table view in my storyboard named timelinetable and after some time I deleted that from my storyboard but after that when debugging it shows an error
Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[ setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key
timelineTable.'
but I cant find anything named timelinetable in my project so how can I fix that problem
Go to the xib
click on files owner and click on the show connection inspector button (last one ).
Check out all the connections . The problem is due to you are referencing the outlet which is no more exist.
you connect an outlet and you then remove the controller without removing its outlet.

Constraint must contain a first layout item NSLayoutConstraint

I had my LayoutConstraints working fine, then all of a sudden I started getting this when adding Constraints to my view.
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** +[NSLayoutConstraint constraintWithItem:attribute:relatedBy:toItem:attribute:multiplier:constant:]: Constraint must contain a first layout item'
*** First throw call stack:
(0x7cd012 0x2017e7e 0x7ccdeb 0xde6bf1 0x9c487 0x994a3 0x414fb 0x20224 0x5c6c0 0xc30e83 0x78c376 0x78be06 0x773a82 0x772f44 0x772e1b 0x28eb7e3 0x28eb668 0x149465c 0x2cfd 0x2c25)
libc++abi.dylib: terminate called throwing an exception
And there exists no immediate documentation on the internet or on the Apple Docs as to what the error message means.
Just wondering if anyone has encountered this error, and know what I can do to troubleshoot it?
One more reason for this error/crash can be, the views passed to the [NSLayoutContraint constraintWithItem ...] method are nil.
Ah, found the issue.
For anyone who has this issue, it's because the view hasn't been created in the nib/UIView yet, so no constraints can apply.
I moved the Constraint code from the initWithNib method to viewDidLoad and the error naturally stopped occurring.
If you're hanging on to your views with properties make sure they're strong! This could account for them being nil.
This can also happen if you switch off Autolayout for some reason, but you're still adding constraints to any subview via code (e.g. for handling orientation changes)
This happened to me when I used to different NIB's for the iPhone and iPad and switched off Autolayout for only the iPhone NIB while using a common .m file.
Solution is to check for the device type and skip the layout addition where it's not needed.
This happened when I accidentally deleted the 'referencing outlet' for one of my UI elements.

Resources