Overhang subviews getting created twice Exception MAC - macos

I am getting this exception in MAC where I am creating two Tab View Item in a Window.I have a table view for each tab.
I searched a lot but could not see any soultions? Can anybody help me ?
SourceCache/AppKit/AppKit-1265.21/AppKit.subproj/NSClipView.m:945
2014-07-30 13:54:08.204 Intralinks VIA[728:1003] An uncaught exception was raised
2014-07-30 13:54:08.204 Intralinks VIA[728:1003] Overhang subviews getting created twice!
2014-07-30 13:54:08.205 Intralinks VIA[728:1003] (
0 CoreFoundation 0x00007fff9474025c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8d321e75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff94740038 +[NSException raise:format:arguments:] + 104
3 Foundation 0x00007fff8a088d41 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 189
4 AppKit 0x00007fff92b34cfd -[NSClipView _addOverhangSubviewsIfNeeded] + 150
5 AppKit 0x00007fff9278c451 -[NSClipView setDocumentView:] + 530
6 AppKit 0x00007fff9278bfe8 -[NSScrollView setDocumentView:] + 114
7 AppKit 0x00007fff9271e7de -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 358
8 AppKit 0x00007fff927135ce loadNib + 327
9 AppKit 0x00007fff92712b6c +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 288
10 AppKit 0x00007fff929a74d2 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 140
11 AppKit 0x00007fff929a72ca -[NSWindowController loadWindow] + 196
12 AppKit 0x00007fff929abf88 -[NSWindowController window] + 80
13 AppKit 0x00007fff929ad0f0 -[NSWindowController showWindow:] + 36

I got the answer.
The issue was I was calling showWindow from a Background Thread and not the main thread.

Related

Cocoa UI IBAction call seems to corrupt NSTimer

I have a function:
NSTimer *learnUSBTimer=nil;
- (void)showUSBWindow:(id)sender {
[self updateDeviceButton:#"Cancel"];
[self hideDeviceClearButton:TRUE];
[selectedDeviceField setStringValue:#"Insert the USB device..."];
learnUSBMode=1;
if(learnUSBTimer)
{
if([learnUSBTimer isValid])[learnUSBTimer invalidate];
learnUSBTimer=nil;
}
}
And it seems my message sent to the timer object is being sent to the UI object:
2018-02-19 14:02:34.649581-0500 TokenLock[4068:819373] -[NSBox isValid]: unrecognized selector sent to instance 0x60000016bc40
2018-02-19 14:02:34.649691-0500 TokenLock[4068:819373] [General] -[NSBox isValid]: unrecognized selector sent to instance 0x60000016bc40
2018-02-19 14:02:34.651799-0500 TokenLock[4068:819373] [General] (
0 CoreFoundation 0x00007fff4f33833b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff7607c942 objc_exception_throw + 48
2 CoreFoundation 0x00007fff4f3cf5e4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x00007fff4f2aff03 ___forwarding___ + 1443
4 CoreFoundation 0x00007fff4f2af8d8 _CF_forwarding_prep_0 + 120
5 TokenLock 0x0000000100014cdc -[AppController showUSBWindow:] + 252
6 AppKit 0x00007fff4d02375a -[NSApplication(NSResponder) sendAction:to:from:] + 312
7 AppKit 0x00007fff4cac9933 -[NSControl sendAction:to:] + 86
8 AppKit 0x00007fff4cac985b __26-[NSCell _sendActionFrom:]_block_invoke + 136
9 AppKit 0x00007fff4cac9761 -[NSCell _sendActionFrom:] + 183
10 AppKit 0x00007fff4cb0aa18 -[NSButtonCell _sendActionFrom:] + 97
11 AppKit 0x00007fff4cac7fca -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2438
12 AppKit 0x00007fff4cb0a75f -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 777
13 AppKit 0x00007fff4cac6a64 -[NSControl mouseDown:] + 965
14 AppKit 0x00007fff4d1c2959 -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 5891
15 AppKit 0x00007fff4d1bf5b0 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2359
16 AppKit 0x00007fff4d1be85c -[NSWindow(NSEventRouting) sendEvent:] + 497
17 AppKit 0x00007fff4d01f617 -[NSApplication(NSEvent) sendEvent:] + 307
18 AppKit 0x00007fff4c880d9d -[NSApplication run] + 812
19 AppKit 0x00007fff4c84ff1a NSApplicationMain + 804
20 TokenLock 0x0000000100001ea1 main + 97
21 TokenLock 0x0000000100001e34 start + 52
)
I dont understand how my NSTimer is being somehow assigned to the UI Box being clicked to execute the function?
It seems that there will be some memory management issue in your code. And the objects are not properly allocated/ deallocated or not initialised deinitialised properly.
So to solve this issue just run your code by enabling zombies into your project target settings.
It turns out this timer fires once. I was not setting it to nil in that code and so it became essentially an orphan because the system released the actual timer object after.
Setting it to nil on firing fixes the issue.

How to solve error 'self.floatingGroupRowView should be equal to the given row view!'?

My macOS app uses a NSTableView with 'Floats Group Row' enabled. This works without problems on my test Macs. However, on a regular basis I receive crash reports from users with:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'self.floatingGroupRowView should be equal to the given row view!'
Does anyone know the conditions for this error?
The last part of the crashlog look similar to this:
0 CoreFoundation 0x00007fff51db6ff3 __exceptionPreprocess + 147
1 libobjc.A.dylib 0x00007fff78992c76 objc_exception_throw + 48
2 CoreFoundation 0x00007fff51dbcda2 +[NSException raise:format:arguments:] + 98
3 Foundation 0x00007fff53ebb260 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 192
4 AppKit 0x00007fff4f656e9f -[NSTableRowData _updateFloatingGroupRowView:row:] + 421
5 AppKit 0x00007fff4f4245db -[NSTableRowData _updateFrameRowView:row:] + 100
6 AppKit 0x00007fff4fd03fca __48-[NSTableRowData _doAutomaticRowHeightsForRows:]_block_invoke.1004 + 47
7 AppKit 0x00007fff4f40eae2 -[NSTableRowData enumerateAvailableRowViewsUsingBlock:] + 139
8 AppKit 0x00007fff4fd03ede -[NSTableRowData _doAutomaticRowHeightsForRows:] + 274
9 AppKit 0x00007fff4fd07157 __59-[NSTableRowData _automaticRowHeightsUpdateVisibleRowViews]_block_invoke.1494 + 141
10 AppKit 0x00007fff4fd06d05 -[NSTableRowData _keepTopRowStable:andDoWorkUntilDone:] + 535
11 AppKit 0x00007fff4fd07075 -[NSTableRowData _automaticRowHeightsUpdateVisibleRowViews] + 161
12 AppKit 0x00007fff4f415d85 -[NSTableRowData updateVisibleRowViews] + 261
13 AppKit 0x00007fff4f5bf24e -[NSTableRowData prepareContentInRect:] + 106
14 AppKit 0x00007fff4f5bed46 -[NSTableView prepareContentInRect:] + 303
15 AppKit 0x00007fff4fbbf7b1 __38-[NSView _pullInExtraTilesForOverdraw]_block_invoke + 562
16 AppKit 0x00007fff4f484a19 -[NSView _performWorkOnTilesFromRect:renderedContentRect:maximumRect:scrollVelocity:handler:] + 1544
17 AppKit 0x00007fff4f4841f2 -[NSView _pullInExtraTilesForOverdraw] + 854
18 AppKit 0x00007fff4f483e6d -[NSView _doIdlePrefetch] + 37
Unfortunately, these crashlogs don't point consistently to one particular line in my code.

HandleLongPress : UIPopoverController dealloc reached while popover is still visible

I'm trying to develop a Mapkit app. There is a map, a lot of annotations located on this map. If I touch one of these annotations my app is displaying a custom popover from a storyboard. If I touch another location on view while popover is active, popover disappears without any problem.
But, if I touch one of annotation and move my finger out of annotation without releasing my finger, I got the error.
2014-08-01 11:33:34.160 notamTR[1101:60b] *** Terminating app due to uncaught exception 'NSGenericException', reason: '-[UIPopoverController dealloc] reached while popover is still visible.'
*** First throw call stack:
(
0 CoreFoundation 0x01b231e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x018208e5 objc_exception_throw + 44
2 CoreFoundation 0x01b22fbb +[NSException raise:format:] + 139
3 UIKit 0x00ae195e -[UIPopoverController dealloc] + 86
4 libobjc.A.dylib 0x01831692 _ZN11objc_object17sidetable_releaseEb + 268
5 libobjc.A.dylib 0x01830e81 objc_release + 49
6 myMap 0x0000b82d -[ViewController mapView:didSelectAnnotationView:] + 1885
7 MapKit 0x0017799d -[MKMapView annotationManager:didSelectAnnotationRepresentation:] + 704
8 MapKit 0x001ae9b8 -[MKAnnotationManager selectAnnotation:animated:avoid:] + 715
9 MapKit 0x001ae6e8 -[MKAnnotationManager selectAnnotation:animated:] + 75
10 MapKit 0x00165206 -[MKMapView handleLongPress:] + 993
11 UIKit 0x0087c4f4 _UIGestureRecognizerSendActions + 230
12 UIKit 0x0087b168 -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:] + 383
13 UIKit 0x0087cbdd -[UIGestureRecognizer _delayedUpdateGesture] + 60
14 UIKit 0x0088013d ___UIGestureRecognizerUpdate_block_invoke + 57
15 UIKit 0x008800be _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks + 317
16 UIKit 0x008767ac _UIGestureRecognizerUpdate + 199
17 UIKit 0x00521a5a -[UIWindow _sendGesturesForEvent:] + 1291
18 UIKit 0x00522971 -[UIWindow sendEvent:] + 1021
19 UIKit 0x004f45f2 -[UIApplication sendEvent:] + 242
20 UIKit 0x004de353 _UIApplicationHandleEventQueue + 11455
21 CoreFoundation 0x01aac77f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
22 CoreFoundation 0x01aac10b __CFRunLoopDoSources0 + 235
23 CoreFoundation 0x01ac91ae __CFRunLoopRun + 910
24 CoreFoundation 0x01ac89d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x01ac87eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x032df5ee GSEventRunModal + 192
27 GraphicsServices 0x032df42b GSEventRun + 104
28 UIKit 0x004e0f9b UIApplicationMain + 1225
29 myMap 0x0001c37c main + 92
30 libdyld.dylib 0x020e4701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
It is quite late with this Answer, but for those looking for a solution: Try to create a storong property to hold this popover, and then when taping on the map accessory use the self.popover reference to init it with a content.

Proper way to close NSDocument programmatically

I have a subclass of NSDocument that crashes whenever I use [self close] to avoid the default 'save' dialog for new documents:
2013-02-25 15:23:06.338 MyApp[692:403] An uncaught exception was raised
2013-02-25 15:23:06.338 MyApp[692:403] NSWindow: -_newFirstResponderAfterResigining is not a valid message outside of a responder's implementation of -resignFirstResponder.
2013-02-25 15:23:06.356 MyApp[692:403] (
0 CoreFoundation 0x00007fff8b2cdf56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff88c00d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8b2cdd8a +[NSException raise:format:arguments:] + 106
3 CoreFoundation 0x00007fff8b2cdd14 +[NSException raise:format:] + 116
4 AppKit 0x00007fff858e0c34 -[NSWindow _newFirstResponderAfterResigning] + 164
5 AppKit 0x00007fff85882c8a -[NSTextView(NSSharing) resignFirstResponder] + 54
6 AppKit 0x00007fff8536dd79 -[NSWindow makeFirstResponder:] + 429
7 AppKit 0x00007fff85488dfb -[NSWindow dealloc] + 802
8 AppKit 0x00007fff8528b955 -[NSWindow release] + 535
9 AppKit 0x00007fff858b541c __destroy_helper_block_4 + 26
10 libsystem_blocks.dylib 0x00007fff8702b174 _Block_release + 181
11 libdispatch.dylib 0x00007fff84ab28f2 _dispatch_main_queue_callback_4CF + 308
12 CoreFoundation 0x00007fff8b262e7c __CFRunLoopRun + 1724
13 CoreFoundation 0x00007fff8b262486 CFRunLoopRunSpecific + 230
14 HIToolbox 0x00007fff8d64e2bf RunCurrentEventLoopInMode + 277
15 HIToolbox 0x00007fff8d65556d ReceiveNextEventCommon + 355
16 HIToolbox 0x00007fff8d6553fa BlockUntilNextEventMatchingListInMode + 62
17 AppKit 0x00007fff85252779 _DPSNextEvent + 659
18 AppKit 0x00007fff8525207d -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 135
19 AppKit 0x00007fff8524e9b9 -[NSApplication run] + 470
20 AppKit 0x00007fff854caeac NSApplicationMain + 867
21 MyApp 0x00000001059098d2 main + 34
22 MyApp 0x00000001059098a4 start + 52
23 ??? 0x0000000000000003 0x0 + 3
)
Has anyone seen this before or can anyone suggest a better/proper way to close an NSDocument without the save dialog being shown?
So judging by your followup comments, what you're trying to do is suppress the standard close confirmation sheet under specific circumstances. Some ways to do that:
Adopt autosaving-in-place, which moves away from the ancient paradigm of manually saving documents
Override -[NSDocument canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:] so it tells the delegate "yes, you can close", rather than presenting a sheet
Once a post is made, call [document updateChangeCount: NSChangeCleared] to inform the document that you consider it to be saved

Mac Core Data UnCaught Exception

I get this error:
2013-01-21 15:09:49.479 obtl[13136:403] An uncaught exception was raised
2013-01-21 15:09:49.484 obtl[13136:403] [<NSApplication 0x10012a600> valueForUndefinedKey:]: this class is not key value coding-compliant for the key managedObjectContext.
2013-01-21 15:09:49.493 obtl[13136:403] (
0 CoreFoundation 0x00007fff8c000f56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff934f4d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8c08b1b9 -[NSException raise] + 9
3 Foundation 0x00007fff8ef65703 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 240
4 Foundation 0x00007fff8ee9c38e _NSGetUsingKeyValueGetter + 108
5 Foundation 0x00007fff8ee9c315 -[NSObject(NSKeyValueCoding) valueForKey:] + 392
6 AppKit 0x00007fff938596ef -[NSApplication(NSScripting) valueForKey:] + 510
7 Foundation 0x00007fff8eebbda2 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 348
8 AppKit 0x00007fff936572fa -[NSBinder _valueForKeyPath:ofObject:mode:raisesForNotApplicableKeys:] + 654
9 AppKit 0x00007fff93656fe4 -[NSBinder valueForBinding:resolveMarkersToPlaceholders:] + 171
10 AppKit 0x00007fff93656c52 -[NSObjectParameterBinder _updateObject:observedController:observedKeyPath:context:] + 1181
11 AppKit 0x00007fff93648f8f -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591
12 AppKit 0x00007fff936422a1 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
13 AppKit 0x00007fff936388bb loadNib + 322
14 AppKit 0x00007fff93637db8 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
15 AppKit 0x00007fff93637cd3 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
16 AppKit 0x00007fff93637c16 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
17 AppKit 0x00007fff938a8cd7 NSApplicationMain + 398
18 obtl 0x0000000100001b52 main + 34
19 obtl 0x0000000100001b24 start + 52
)
2013-01-21 15:09:49.503 obtl[13136:403] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<NSApplication 0x10012a600> valueForUndefinedKey:]: this class is not key value coding-compliant for the key managedObjectContext.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff8c000f56 __exceptionPreprocess + 198
1 libobjc.A.dylib 0x00007fff934f4d5e objc_exception_throw + 43
2 CoreFoundation 0x00007fff8c08b1b9 -[NSException raise] + 9
3 Foundation 0x00007fff8ef65703 -[NSObject(NSKeyValueCoding) valueForUndefinedKey:] + 240
4 Foundation 0x00007fff8ee9c38e _NSGetUsingKeyValueGetter + 108
5 Foundation 0x00007fff8ee9c315 -[NSObject(NSKeyValueCoding) valueForKey:] + 392
6 AppKit 0x00007fff938596ef -[NSApplication(NSScripting) valueForKey:] + 510
7 Foundation 0x00007fff8eebbda2 -[NSObject(NSKeyValueCoding) valueForKeyPath:] + 348
8 AppKit 0x00007fff936572fa -[NSBinder _valueForKeyPath:ofObject:mode:raisesForNotApplicableKeys:] + 654
9 AppKit 0x00007fff93656fe4 -[NSBinder valueForBinding:resolveMarkersToPlaceholders:] + 171
10 AppKit 0x00007fff93656c52 -[NSObjectParameterBinder _updateObject:observedController:observedKeyPath:context:] + 1181
11 AppKit 0x00007fff93648f8f -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] + 591
12 AppKit 0x00007fff936422a1 -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] + 1079
13 AppKit 0x00007fff936388bb loadNib + 322
14 AppKit 0x00007fff93637db8 +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] + 217
15 AppKit 0x00007fff93637cd3 +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] + 141
16 AppKit 0x00007fff93637c16 +[NSBundle(NSNibLoading) loadNibNamed:owner:] + 364
17 AppKit 0x00007fff938a8cd7 NSApplicationMain + 398
18 obtl 0x0000000100001b52 main + 34
19 obtl 0x0000000100001b24 start + 52
)
terminate called throwing an exception
Related information:
Mac OSX App (trying to aim for users with Snow Leopard to be able to use it as well).
Everything is bound appropriately to FileOwner.managedObjectContext and the appropriate entity. I have triple checked all of my tables, buttons, etc to make sure that they are attached to the right bindings.
I only have 1 window file.
I am using Xcode 4.5.2 on Mac Lion (without using Auto Layout). I am lost as to how to fix this-and yes I have researched a lot of the similar questions and have tried some of the same solutions to no avail.
From the crash log, it appears that you are loading a nib and that the nib tries to access a managedObjectContext property defined in the nib's owner. It is not found, so the crash. This is probably due to a wrong nib owner.
I would suggest to review your nib file:
the file's owner should be of type: NSApplication;
the file's owner should have a delegate outlet bound to the app delegate;
the app delegate should declare the managedObjectContext property.

Resources