My program crashes due to SIGABRT? - uiimageview

2012-05-31 00:17:51.384 SAMPLEGAME[2901:10703] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<SAMPLEGAMEViewController 0x752c140> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key girlHeadView.'
*** First throw call stack:
(0x1460022 0x1a7dcd6 0x145fee1 0xe47022 0xdb8f6b 0xdb8edb 0xdd3d50 0x6bb71a 0x1461dea 0x13cb7f1 0x6ba26e 0x5601fc 0x560779 0x56099b 0x4bf401 0x4bf670 0x4bf836 0x4c672a 0x497596 0x498274 0x4a7183 0x4a7c38 0x49b634 0x3aa1ef5 0x1434195 0x1398ff2 0x13978da 0x1396d84 0x1396c9b 0x497c65 0x499626 0x21fd 0x2165)
terminate called throwing an exception(lldb)
Hi everyone,
I am new to iOS programming and am lost on something.
I renamed my original UIIMAGEVIEW from "yelOrb"... which was inefficient for the real object in the end replacing a yellow orb. So I renamed it to "girlHeadView". (Mind you, this is what I named the UIImageView that you control with arrow keys.)
Now whenever I run the program I get a stink in' SIGABRT telling me this [in the code above].
I even renamed "girlHeadView" back to "yelOrb".
I went through my .h & .m file, no stray word or incorrect spelling is causing this.
How am I able to fix this? I just implemented a button function to change the UIImageView (I even commented it all out to see if that caused it- still SIGABRT issue) and I can't even run the simulator.
Thank you!
Edit: Found my problem, I had to remove and re-add the yelOrb's image on the storyboard. Odd, but it worked. :)

It sounds like there's an outlet in interface builder connecting the UIImageView to the old property name, yelOrb. Then, when the view controller's view loads, it tries to make that connection to yelOrb which no longer exists, so you get that error.

Related

Assertion error when using NSCollectionView with QLPreviewView

I am using an NSCollectionView where each NSCollectionViewItem uses a QLPreviewView to get a rendering of a file's content.
(This is an attempt at a file browser for images and other previewable files.)
Initially, this works fine.
However, once collection items are getting re-used, I get an assertion error (both in 10.13 and 10.14):
[QL] Assertion failure (unreachable code) - [… MyPreviewView activated … doc:[QLPreviewDocument …]] is already activated
Apparently, before I can re-use a NSCollectionViewItem, the previously used QLPreviewItem needs to be set to inactive state somehow. How do I do that?
I've tried to send the close message to the QLPreviewView instance but that doesn't make a difference.
I also do not get a dealloc call on my QLPreviewView subclass, which suggests that the object is still referenced by something else, possibly the QLPreviewDocument, which then gets confused about the change of state.
I have made a demo project available on github: https://github.com/tempelmann/NSCollectionViewWithQLPreview
To test: Run it, then scroll down. When reaching items 50 to 60, the assertion will be triggered.
The fix is to set QLPrewiewView's shouldCloseWithWindow property to NO.
This, I suspect, tells the controller behind the scenes not to attach itself to higher level structures, i.e. tells it to remain self-sufficient.
So, adding this line to the code that sets up a new MyPrewiewView object in the sample code's ViewController.m file prevents the error:
qlView.shouldCloseWithWindow = NO;

Xcode 7 finding the cause of SIGABRT

I am using Xcode 7 beta 5 and creating a multiview application. One view has a button that brings you to a second view, but when this button is pressed it crashes with Thread 1: Signal SIGABRT.
I have checked all the connections of things inside the target view, and everything appears to be ok (I also went through and redid them to be sure). I have tried adding an exception breakpoints which stopped for something, but I am unsure how to find the faulty line.
I have also tried adding breakpoints manually, and have found the following:
#IBOutlet weak var wakeTimeLabel: UILabel!
#IBAction func snoozeButton(sender: AnyObject) {
snooze()
}
If I put the breakpoint on the first line there (after all the other outlets), it catches, but when I put it on the function line it throws the SIGABRT. If I remove these two lines completely, the SIGABRT still occurs.
The console contains the following:
* Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key whiteSwipe.'
* First throw call stack:
(0x182a2da94 0x197387f80 0x182a2d754 0x1838a3694 0x18829b378 0x1883dd874 0x1829575ac 0x1883dc25c 0x188602fd8 0x1886077c4 0x188607a38 0x188607c94 0x187f755bc 0x187f75538 0x187f5dfa0 0x187f74e50 0x187f74a80 0x187f6dcf0 0x187f3eea4 0x187f3d520 0x1829e50dc 0x1829e4b70 0x1829e2870 0x1829118a0 0x18d96c088 0x187fa60d4 0x1000b4be0 0x197bd68b8)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
Even though you said you redid your connections, Sigabrt is what I recall to be a exception thrown by faulty connections. In particular, your error message is the one that comes out when you change a connection's signature after you've connected it.
For instance, I just got a very similar message after deleting 1 character off an #IBOutlet declaration:
FeedViewCollectionCell 0x7feab0c583b0> setValue:forUndefinedKey:]:
this class is not key value coding-compliant for the key nameLabel.
I suggest you reconnect your outlets again. Make sure you don't have 2 of the same connections on an item, and make sure you don't change the signature after setting the outlet.

dequeueReusableCellWithIdentifier never returns

When I call dequeueReusableCellWithIdentifier it is freezing my code and does never return any cell (or nil) I change the code from my custom class to a UITableViewCell to be sure the problem wasn't in my class, I also create a brand new empty cell to call with the identifier.
I add a log before and after the call for dequeueReusableCellWithIdentifier as you can see in the screenshot the one before gets called once and the one after never.
I try to clean and build, clean the project folder, delete DerivedData, restart the computer. I can't see any exceptions or what is really holding the code.
Any suggestions?
I am not sure what happened to XCode, but, if someone find the same problem here is what I had to do.
I didn't find anything wrong with the cell (yes I was using storyboard and the identifier was set correctly) and noting was wrong with the code in the custom class as well. I even went to the point of create a secondary custom class and custom cell and it did not help, so I try to put a invalid identifier and even there XCode did not return me an error (as it should).
I had to delete my custom cell from the storyboard, as soon as I did that all start to work again, first the error that the identifier didn't exist, than the temporary one start to work, than I recreate the original one (exactly as before) and all start to work again.
Very overkill but worked for me. Thanks for all the help!
It is expressed that you are printing println("return dequeueReusableCellWithIdentifier"), but can't see your return cell code at the end of your function, that must conform to your function expectation.

CGContextSetCompositeOperation error for some users when drawing NSWindow

A simple 10.6 Cocoa app I wrote that basically draws a regular window with some buttons and text has been spewing hundreds of console log messages:
<Error>: CGContextSetCompositeOperation: invalid context 0x0
I do not directly call drawRect: and always use setNeedsDisplay:YES when I need to refresh.
Interestingly, this error does not happen on all machines, I'd say about 50% get the error. However, the program works fine in either case!
Anyone got any clue as to what this error means, where it's stemming from, and more importantly, how can I suppress/get rid of it?
Thanks
Try setting a breakpoint on CGPostError. If you can break on the logging, you can hopefully figure out what's going on.
You shouldn't be looking to just suppress it. It means context creation is failing (thus NULL gets passed for some context parameter), and that's not good.

Cocoa NSOutlineView bug - [NSCFTimer copyWithZone:]: unrecognized selector sent to instance

I'm using an NSOutlineView with the function
- (BOOL)outlineView:(NSOutlineView *)outlineView
isGroupItem:(id)item
defined so it gives the group row GUI look. When I add a root item, it works fine. When I add an item to root's child array and expand it, it works fine. If I contract the item though, the following error is logged:
[NSCFTimer copyWithZone:]: unrecognized selector sent to instance
I also get an EXC_BAD_ACCESS error if the app window is deactivated by switching to another app. I used the debugger to try to find where I might have made an error in one of my functions, but the stack trace only shows functions I did not create (RunCurrentEventLoopInMode, CFRunLoopRunSpecific, handleWindowNeedsDisplay, etc.) Does anyone have any idea where my error(s) might be?
Sounds like an object is dying prematurely. You get the “unrecognized selector sent to instance” exception when a new object is allocated later with the same pointer and then something tries to send the old object a message (in the example shown, the reincarnation is an NSTimer and the message something tried to send the previous object was copyWithZone:). You get an EXC_BAD_ACCESS crash when the object is simply garbage memory.
Debug this by running your app under Instruments with the Zombies instrument enabled. The object will, instead of dying, become a zombie object. When something tries to send a zombie a message, the zombie will moan (figuratively speaking), which will show up in Instruments's timeline as a flag. You can click a button in that flag to view the history of the object, including all of its retentions and releases.

Resources