Instruments.app crash when profiling - iphone

Instruments.app crashes when I try to profile on the device. It works fine in the simulator.
This happens with all instruments- time profiler, leaks, etc. I am able to use the energy diagnostics instrument.
I tried:
Made sure app was set to debug mode (also tried with release mode)
Reinstalling xcode
Rebooting device/computer
Attaching to process once app is running
My main device is an iPhone 4 running 5.1, jailbroken but this also happens on a non-jailbroken iPhone running 4.3.x
Please let me know if you have any thoughts on why this is happening.
Partial crash log below
Process: Instruments [12983]
Path: /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/MacOS/Instruments
Identifier: com.apple.dt.Instruments
Version: 4.3 (4321)
Build Info: Instruments-4321000000000000~2
Code Type: X86-64 (Native)
Parent Process: launchd [253]
Date/Time: 2012-06-08 16:27:06.214 -0400
OS Version: Mac OS X 10.7.4 (11E53)
Report Version: 9
Sleep/Wake UUID: 1556D9E2-2B8A-4A76-A591-F8ACEF479C31
Interval Since Last Report: 24319 sec
Crashes Since Last Report: 8
Per-App Interval Since Last Report: 13147 sec
Per-App Crashes Since Last Report: 7
Anonymous UUID: A73B414D-9FB6-4055-94D3-A887EB7ADFFD
Crashed Thread: 7
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000004
VM Regions Near 0x4:
-->
__TEXT 0000000101a71000-0000000101a76000 [ 20K] r-x/rwx SM=COW /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/MacOS/Instruments
Application Specific Information:
objc[12983]: garbage collection is OFF
Thread 0:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff849ab67a mach_msg_trap + 10
1 libsystem_kernel.dylib 0x00007fff849aad71 mach_msg + 73
2 com.apple.framework.IOKit 0x00007fff826899bf io_service_get_matching_services + 210
3 com.apple.framework.IOKit 0x00007fff82641604 IOServiceGetMatchingServices + 137
4 com.apple.framework.IOKit 0x00007fff82641741 IOServiceGetMatchingService + 25
5 com.apple.Foundation 0x00007fff85f7710b +[NSFileWrapper _canSafelyMapFilesAtPath:] + 241
6 com.apple.Foundation 0x00007fff85f1c510 -[NSData(NSData) initWithContentsOfFile:options:error:] + 139
7 com.apple.Foundation 0x00007fff85f83b48 -[NSData(NSData) initWithContentsOfURL:options:error:] + 238
8 com.apple.AppKit 0x00007fff89e6e387 NSImageRepNewDataFromFileURL + 247
9 com.apple.AppKit 0x00007fff89aa00fc +[NSImageRep _imageRepsWithContentsOfURL:expandImageContentNow:giveUpOnNetworkURLsWithoutGoodExtensions:] + 548
10 com.apple.AppKit 0x00007fff89a9fe9a __-[NSImageURLReferencingRepProvider representations]_block_invoke_1 + 48
11 com.apple.Foundation 0x00007fff85f34347 _NSFaultInObject + 35
12 com.apple.AppKit 0x00007fff89a70ae7 -[NSImageURLReferencingRepProvider representations] + 80
13 com.apple.AppKit 0x00007fff89a9fd7e __-[NSImage size]_block_invoke_1 + 353
14 com.apple.AppKit 0x00007fff89a2b825 -[NSImage _usingRepProviderPerformBlock:] + 37
15 com.apple.AppKit 0x00007fff89a596c2 -[NSImage size] + 129
16 com.apple.AppKit 0x00007fff89a9f9a6 -[NSImage alignmentRect] + 51
17 com.apple.AppKit 0x00007fff89b08de5 -[NSImageCell _imageRectForDrawing:inFrame:inView:] + 43
18 com.apple.AppKit 0x00007fff89b08c6b -[NSImageCell drawInteriorWithFrame:inView:] + 541
19 com.apple.AppKit 0x00007fff89b08a28 -[NSImageCell drawWithFrame:inView:] + 1705
20 com.apple.AppKit 0x00007fff89a9ddb7 -[NSControl drawRect:] + 398
21 com.apple.AppKit 0x00007fff89a6997a -[NSView _drawRect:clip:] + 3758
22 com.apple.AppKit 0x00007fff89a96b4f -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1583
23 com.apple.AppKit 0x00007fff89a96f7b -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2651
24 com.apple.AppKit 0x00007fff89a96f7b -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2651
25 com.apple.AppKit 0x00007fff89a96f7b -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2651
26 com.apple.AppKit 0x00007fff89a96f7b -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2651
27 com.apple.AppKit 0x00007fff89a96f7b -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2651
28 com.apple.AppKit 0x00007fff89a96f7b -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2651
29 com.apple.AppKit 0x00007fff89a96f7b -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 2651
30 com.apple.AppKit 0x00007fff89a66f55 -[NSView _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 1032
31 com.apple.AppKit 0x00007fff89a6644f -[NSThemeFrame _recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView:] + 270
32 com.apple.AppKit 0x00007fff89a6186f -[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] + 4755
33 com.apple.AppKit 0x00007fff89a5a2ed -[NSView displayIfNeeded] + 1676
34 com.apple.dt.instruments.InstrumentsKit 0x0000000101a8e155 -[XRSplitViewAnimation setCurrentProgress:] + 81
35 com.apple.AppKit 0x00007fff89bec62d -[NSAnimation(NSInternal) _advanceTimeWithTimer:] + 156
36 com.apple.Foundation 0x00007fff85f4ef40 __NSFireTimer + 102
37 com.apple.CoreFoundation 0x00007fff8689b934 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 20
38 com.apple.CoreFoundation 0x00007fff8689b486 __CFRunLoopDoTimer + 534
39 com.apple.CoreFoundation 0x00007fff8687be11 __CFRunLoopRun + 1617
40 com.apple.CoreFoundation 0x00007fff8687b486 CFRunLoopRunSpecific + 230
41 com.apple.Foundation 0x00007fff85f02f7b -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 267
42 com.apple.AppKit 0x00007fff89cc956c -[NSAnimation(NSInternal) _runBlocking] + 365
43 com.apple.dt.instruments.InstrumentsKit 0x0000000101a8e058 -[XRHorizontalFillSplitView animateSplitFromPosition:toPosition:] + 377
44 com.apple.dt.instruments.InstrumentsKit 0x0000000101a8dc86 -[PFTTraceDocument animateLowerVisibility:] + 215
45 com.apple.dt.instruments.InstrumentsKit 0x0000000101aaa3e5 -[PFTTraceDocument toggleDetail:] + 71
46 com.apple.dt.instruments.InstrumentsKit 0x0000000101aaa320 -[PFTTraceDocument _didStartCommand:] + 238
47 com.apple.Foundation 0x00007fff85f0dd0e __-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke_1 + 47
48 com.apple.CoreFoundation 0x00007fff8688f7ba _CFXNotificationPost + 2634
49 com.apple.Foundation 0x00007fff85ef9fc3 -[NSNotificationCenter postNotificationName:object:userInfo:] + 65
50 com.apple.dt.instruments.InstrumentsPlugIn 0x0000000101c5f8c7 -[XRTrace startCommandWithPurpose:] + 1546
51 com.apple.dt.instruments.InstrumentsKit 0x0000000101aa8d4d -[PFTTraceDocument startRun] + 164
52 com.apple.dt.instruments.InstrumentsKit 0x0000000101aa8b55 -[PFTTraceDocument recordTrace:] + 599
53 com.apple.dt.instruments.InstrumentsKit 0x0000000101ae370d -[PFTDocumentController openDocumentWithContentsOfURL:display:error:] + 2769
54 com.apple.dt.instruments.InstrumentsKit 0x0000000101ae3f3a -[PFTDocumentController _templateChooserActionEnded:returnCode:contextInfo:] + 494
55 com.apple.AppKit 0x00007fff89cd13df -[NSApplication endSheet:returnCode:] + 275
56 com.apple.imageKit 0x00007fff896992fb -[IKImageBrowserView(ImageBrowserEvents) mouseUp:] + 649
57 com.apple.AppKit 0x00007fff89aea40e -[NSWindow sendEvent:] + 6504
58 com.apple.AppKit 0x00007fff89a83a55 -[NSApplication sendEvent:] + 5593
59 com.apple.dt.Instruments 0x0000000101a7339f 0x101a71000 + 9119
60 com.apple.AppKit 0x00007fff89a1a0c6 -[NSApplication run] + 555
61 com.apple.AppKit 0x00007fff89c96244 NSApplicationMain + 867
62 com.apple.dt.Instruments 0x0000000101a73724 0x101a71000 + 10020

Appears to be fixed with Instruments 4.4

Related

How do I get my Xamarin app running on an iOS device?

Can anyone help me?
I'm developing a Xamarin Forms app in Visual Studio 2022 on a Windows PC. I have VS attached to a MacinCloud Mac and an iPhone connected to the Windows PC.
My app deploys and starts up on the iPhone but when I go to login it crashes.
The line of code it is crashing on is making a call to HttpClient.PostAsync to call back to our API to authenticate.
The error and crash dump are below.
Any ideas?
Thanks,
Paul.
Foundation.MonoTouchException
Message=Objective-C exception thrown. Name: NSMallocException Reason: Failed to grow buffer
Native stack trace:
0 CoreFoundation 0x0000000180a35060 B2D21CFD-378C-36D5-BAF7-3F70599CFEFC + 626784
1 libobjc.A.dylib 0x00000001990a9f54 objc_exception_throw + 60
2 CoreFoundation 0x0000000180b42af0 B2D21CFD-378C-36D5-BAF7-3F70599CFEFC + 1731312
3 CoreFoundation 0x0000000180b3addc B2D21CFD-378C-36D5-BAF7-3F70599CFEFC + 1699292
4 CoreFoundation 0x00000001809cf28c __CFSafelyReallocate + 72
5 Foundation 0x00000001821f6a48 D59C6975-5AF2-37BC-93BE-43B80B4293A5 + 232008
6 Foundation 0x00000001821f26d4 D59C6975-5AF2-37BC-93BE-43B80B4293A5 + 214740
7 Xamarin.PreBuilt.iOS 0x00000001024e9c54 do_icall + 328
8 Xamarin.PreBuilt.iOS 0x00000001024e82e4 do_icall_wrapper + 296
9 Xamarin.PreBuilt.iOS 0x00000001024df1d8 interp_exec_method_full + 2740
10 Xamarin.PreBuilt.iOS 0x00000001024dd768 interp_runtime_invoke + 336
11 Xamarin.PreBuilt.iOS 0x000000010234ae70 mono_jit_runtime_invoke + 900
12 Xamarin.PreBuilt.iOS 0x00000001023f9188 mono_runtime_try_invoke + 156
13 Xamarin.PreBuilt.iOS 0x00000001023faddc mono_runtime_invoke + 100
14 Xamarin.PreBuilt.iOS 0x00000001022613e0 _ZL31native_to_managed_trampoline_11P11objc_objectP13objc_selectorPP11_MonoMethodj + 244
15 Xamarin.PreBuilt.iOS 0x00000001022a7db8 -[UIKit_UIControlEventProxy BridgeSelector] + 44
16 UIKitCore 0x000000018330abf0 8388EB03-002B-3B35-A78A-6A022894292E + 5016560
17 UIKitCore 0x0000000183436a4c 8388EB03-002B-3B35-A78A-6A022894292E + 6244940
18 UIKitCore 0x00000001831b22c8 8388EB03-002B-3B35-A78A-6A022894292E + 3605192
19 UIKitCore 0x000000018324eae0 8388EB03-002B-3B35-A78A-6A022894292E + 4246240
20 UIKitCore 0x00000001834e17c0 8388EB03-002B-3B35-A78A-6A022894292E + 6944704
21 UIKitCore 0x0000000182fa6d40 8388EB03-002B-3B35-A78A-6A022894292E + 1461568
22 UIKitCore 0x0000000182fd98c8 8388EB03-002B-3B35-A78A-6A022894292E + 1669320
23 UIKitCore 0x0000000182fe6a68 8388EB03-002B-3B35-A78A-6A022894292E + 1722984
24 UIKitCore 0x0000000183196318 8388EB03-002B-3B35-A78A-6A022894292E + 3490584
25 UIKitCore 0x0000000182fb9c30 8388EB03-002B-3B35-A78A-6A022894292E + 1539120
26 UIKitCore 0x0000000182faea1c 8388EB03-002B-3B35-A78A-6A022894292E + 1493532
27 UIKitCore 0x0000000182fb3ec8 8388EB03-002B-3B35-A78A-6A022894292E + 1515208
28 CoreFoundation 0x0000000180a57020 B2D21CFD-378C-36D5-BAF7-3F70599CFEFC + 765984
29 CoreFoundation 0x0000000180a67ce0 B2D21CFD-378C-36D5-BAF7-3F70599CFEFC + 834784
30 CoreFoundation 0x00000001809a1fe8 B2D21CFD-378C-36D5-BAF7-3F70599CFEFC + 24552
31 CoreFoundation 0x00000001809a77f4 B2D21CFD-378C-36D5-BAF7-3F70599CFEFC + 47092
32 CoreFoundation 0x00000001809bb3b8 CFRunLoopRunSpecific + 600
33 GraphicsServices 0x000000019c34b38c GSEventRunModal + 164
34 UIKitCore 0x000000018335b6a8 8388EB03-002B-3B35-A78A-6A022894292E + 5346984
35 UIKitCore 0x00000001830da7f4 UIApplicationMain + 2092
36 Xamarin.PreBuilt.iOS 0x00000001024e9bb0 do_icall + 164
37 Xamarin.PreBuilt.iOS 0x00000001024e82e4 do_icall_wrapper + 296
38 Xamarin.PreBuilt.iOS 0x00000001024df1d8 interp_exec_method_full + 2740
39 Xamarin.PreBuilt.iOS 0x00000001024dd768 interp_runtime_invoke + 336
40 Xamarin.PreBuilt.iOS 0x000000010234ae70 mono_jit_runtime_invoke + 900
41 Xamarin.PreBuilt.iOS 0x00000001023f7984 mono_runtime_invoke_checked + 148
42 Xamarin.PreBuilt.iOS 0x00000001023fe000 mono_runtime_try_invoke_array + 1272
43 Xamarin.PreBuilt.iOS 0x00000001023a74f0 ves_icall_InternalInvoke + 1036
44 Xamarin.PreBuilt.iOS 0x00000001023b7780 ves_icall_InternalInvoke_raw + 108
45 Xamarin.PreBuilt.iOS 0x00000001024e9bb0 do_icall + 164
46 Xamarin.PreBuilt.iOS 0x00000001024e82e4 do_icall_wrapper + 296
47 Xamarin.PreBuilt.iOS 0x00000001024df1d8 interp_exec_method_full + 2740
48 Xamarin.PreBuilt.iOS 0x00000001024dd768 interp_runtime_invoke + 336
49 Xamarin.PreBuilt.iOS 0x000000010234ae70 mono_jit_runtime_invoke + 900
50 Xamarin.PreBuilt.iOS 0x00000001023f7984 mono_runtime_invoke_checked + 148
51 Xamarin.PreBuilt.iOS 0x00000001023fcbf8 mono_runtime_exec_main_checked + 128
52 Xamarin.PreBuilt.iOS 0x000000010232f850 mono_jit_exec + 376
53 Xamarin.PreBuilt.iOS 0x00000001024db834 xamarin_main + 1944
54 Xamarin.PreBuilt.iOS 0x00000001022f74f4 main + 76
55 dyld 0x0000000102e71a24 start + 520
Source=Xamarin.iOS
StackTrace:
at ObjCRuntime.Runtime.ThrowNSException (System.IntPtr ns_exception) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/src/ObjCRuntime/Runtime.cs:449
at ObjCRuntime.Runtime.throw_ns_exception (System.IntPtr exc) [0x00000] in /Users/builder/azdo/_work/1/s/xamarin-macios/runtime/Delegates.generated.cs:392
at (wrapper native-to-managed) ObjCRuntime.Runtime.throw_ns_exception(intptr)
I have managed to solve this issue by creating a handler and passing it in to the constructor of my Http client.
var handler = new HttpClientHandler();
var httpClient = new HttpClient(handler);
I thought I had already tried this solution earlier to no avail but I found a second place that was creating the client and implementing it there as well solved the issue.

macCatalyst crash on UIScene in macOS 11 (Big Sur) [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
I have a macCatalyst app that works perfectly on macOS 10.14, however on upgrading to macOS 11 (Big Sur) both I and my users are complaining that the app crashes on launch. I get an error message "Parameter was not of class UIScene" - do macCatalyst apps now require the use of scenes?
On further inspection, I see the following:
2020-11-28 01:48:40.327810+0000 AppName [13691:435322] *** Assertion failure in -[_UISceneMacHelperUtilities sceneIdentifierForUIScene:], _UISceneMacHelperUtilities.m:83
2020-11-28 01:48:40.336334+0000 AppName[13691:435322] [General] An uncaught exception was raised
2020-11-28 01:48:40.336423+0000 AppName[13691:435322] [General] Parameter was not of class UIScene.
2020-11-28 01:48:40.336545+0000 AppName[13691:435322] [General] (
0 CoreFoundation 0x00007fff204ae6af __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201e63c9 objc_exception_throw + 48
2 CoreFoundation 0x00007fff204d7512 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff212906c9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff44a7b2c6 -[_UISceneMacHelperUtilities sceneIdentifierForUIScene:] + 195
5 UIKitMacHelper 0x00007fff34045f74 __46-[UINSApplicationDelegate _setupKeyWindowSync]_block_invoke + 393
6 Foundation 0x00007fff21192d6b -[__NSObserver _doit:] + 287
7 CoreFoundation 0x00007fff20429fdc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
8 CoreFoundation 0x00007fff204c589b ___CFXRegistrationPost_block_invoke + 49
9 CoreFoundation 0x00007fff204c580f _CFXRegistrationPost + 454
10 CoreFoundation 0x00007fff203fabce _CFXNotificationPost + 723
11 Foundation 0x00007fff21166abe -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
12 UIKitCore 0x00007fff44376779 -[UIWindow _makeKeyWindowIgnoringOldKeyWindow:] + 567
13 AppName 0x00000001013fe0c0 $s25AppName13SceneDelegateC5scene_13willConnectTo7optionsySo7UISceneC_So0K7SessionCSo0K17ConnectionOptionsCtF + 1520
14 AppName 0x00000001013feaa6 $s25AppName13SceneDelegateC5scene_13willConnectTo7optionsySo7UISceneC_So0K7SessionCSo0K17ConnectionOptionsCtFTo + 118
15 UIKitCore 0x00007fff44221a31 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1463
16 UIKitCore 0x00007fff4421ffb1 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1109
17 UIKitCore 0x00007fff4421ecfe -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 299
18 UIKitCore 0x00007fff4421eb49 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358
19 FrontBoardServices 0x00007fff317e7312 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 391
20 FrontBoardServices 0x00007fff318045df __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 102
21 FrontBoardServices 0x00007fff317d60c1 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
22 FrontBoardServices 0x00007fff318042b7 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 354
23 libdispatch.dylib 0x00000001040c50b0 _dispatch_client_callout + 8
24 libdispatch.dylib 0x00000001040c8927 _dispatch_block_invoke_direct + 286
25 FrontBoardServices 0x00007fff317d5fd8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
26 FrontBoardServices 0x00007fff3181e1c3 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 433
27 FrontBoardServices 0x00007fff317d5fa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 22
28 CoreFoundation 0x00007fff204349fc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x00007fff20434964 __CFRunLoopDoSource0 + 180
30 CoreFoundation 0x00007fff204346df __CFRunLoopDoSources0 + 248
31 CoreFoundation 0x00007fff20433111 __CFRunLoopRun + 890
32 CoreFoundation 0x00007fff204326be CFRunLoopRunSpecific + 563
33 HIToolbox 0x00007fff2869efd0 RunCurrentEventLoopInMode + 292
34 HIToolbox 0x00007fff2869edcc ReceiveNextEventCommon + 709
35 HIToolbox 0x00007fff2869eaef _BlockUntilNextEventMatchingListInModeWithFilter + 64
36 AppKit 0x00007fff22c4bf85 _DPSNextEvent + 883
37 AppKit 0x00007fff22c4a74b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1366
38 AppKit 0x00007fff22c3cbda -[NSApplication run] + 586
39 AppKit 0x00007fff22c10f31 NSApplicationMain + 816
40 AppKit 0x00007fff22f0744d _NSApplicationMainWithInfoDictionary + 16
41 UIKitMacHelper 0x00007fff3403332e UINSApplicationMain + 1418
42 UIKitCore 0x00007fff44202e30 UIApplicationMain + 144
43 AppName 0x00000001014da40b main + 75
44 libdyld.dylib 0x00007fff20357631 start + 1
)
2020-11-28 01:48:40.337802+0000 AppName[13691:435322] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Parameter was not of class UIScene.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff204ae6af __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201e63c9 objc_exception_throw + 48
2 CoreFoundation 0x00007fff204d7512 +[NSException raise:format:arguments:] + 88
3 Foundation 0x00007fff212906c9 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 191
4 UIKitCore 0x00007fff44a7b2c6 -[_UISceneMacHelperUtilities sceneIdentifierForUIScene:] + 195
5 UIKitMacHelper 0x00007fff34045f74 __46-[UINSApplicationDelegate _setupKeyWindowSync]_block_invoke + 393
6 Foundation 0x00007fff21192d6b -[__NSObserver _doit:] + 287
7 CoreFoundation 0x00007fff20429fdc __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 12
8 CoreFoundation 0x00007fff204c589b ___CFXRegistrationPost_block_invoke + 49
9 CoreFoundation 0x00007fff204c580f _CFXRegistrationPost + 454
10 CoreFoundation 0x00007fff203fabce _CFXNotificationPost + 723
11 Foundation 0x00007fff21166abe -[NSNotificationCenter postNotificationName:object:userInfo:] + 59
12 UIKitCore 0x00007fff44376779 -[UIWindow _makeKeyWindowIgnoringOldKeyWindow:] + 567
13 AppName 0x00000001013fe0c0 $s25AppName13SceneDelegateC5scene_13willConnectTo7optionsySo7UISceneC_So0K7SessionCSo0K17ConnectionOptionsCtF + 1520
14 AppName 0x00000001013feaa6 $s25AppName13SceneDelegateC5scene_13willConnectTo7optionsySo7UISceneC_So0K7SessionCSo0K17ConnectionOptionsCtFTo + 118
15 UIKitCore 0x00007fff44221a31 +[UIScene _sceneForFBSScene:create:withSession:connectionOptions:] + 1463
16 UIKitCore 0x00007fff4421ffb1 -[UIApplication _connectUISceneFromFBSScene:transitionContext:] + 1109
17 UIKitCore 0x00007fff4421ecfe -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 299
18 UIKitCore 0x00007fff4421eb49 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 358
19 FrontBoardServices 0x00007fff317e7312 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 391
20 FrontBoardServices 0x00007fff318045df __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke.176 + 102
21 FrontBoardServices 0x00007fff317d60c1 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 209
22 FrontBoardServices 0x00007fff318042b7 __94-[FBSWorkspaceScenesClient createWithSceneID:groupID:parameters:transitionContext:completion:]_block_invoke + 354
23 libdispatch.dylib 0x00000001040c50b0 _dispatch_client_callout + 8
24 libdispatch.dylib 0x00000001040c8927 _dispatch_block_invoke_direct + 286
25 FrontBoardServices 0x00007fff317d5fd8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
26 FrontBoardServices 0x00007fff3181e1c3 -[FBSSerialQueue _targetQueue_performNextIfPossible] + 433
27 FrontBoardServices 0x00007fff317d5fa0 -[FBSSerialQueue _performNextFromRunLoopSource] + 22
28 CoreFoundation 0x00007fff204349fc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
29 CoreFoundation 0x00007fff20434964 __CFRunLoopDoSource0 + 180
30 CoreFoundation 0x00007fff204346df __CFRunLoopDoSources0 + 248
31 CoreFoundation 0x00007fff20433111 __CFRunLoopRun + 890
32 CoreFoundation 0x00007fff204326be CFRunLoopRunSpecific + 563
33 HIToolbox 0x00007fff2869efd0 RunCurrentEventLoopInMode + 292
34 HIToolbox 0x00007fff2869edcc ReceiveNextEventCommon + 709
35 HIToolbox 0x00007fff2869eaef _BlockUntilNextEventMatchingListInModeWithFilter + 64
36 AppKit 0x00007fff22c4bf85 _DPSNextEvent + 883
37 AppKit 0x00007fff22c4a74b -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1366
38 AppKit 0x00007fff22c3cbda -[NSApplication run] + 586
39 AppKit 0x00007fff22c10f31 NSApplicationMain + 816
40 AppKit 0x00007fff22f0744d _NSApplicationMainWithInfoDictionary + 16
41 UIKitMacHelper 0x00007fff3403332e UINSApplicationMain + 1418
42 UIKitCore 0x00007fff44202e30 UIApplicationMain + 144
43 AppName 0x00000001014da40b main + 75
44 libdyld.dylib 0x00007fff20357631 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Parameter was not of class UIScene.'
terminating with uncaught exception of type NSException

Xcode crashing with selection failed. window:<IDEWorkspaceWindow: 0x7fe212057430> currentlySelectedTabbedWindow:<IDEWorkspaceWindow: 0x7fe213cb5310>

Code crashing with below stack traces:
It will not allowed to open project file which was already opened and minimised.
Process: Xcode [644]
Path: /Applications/Xcode_10.app/Contents/MacOS/Xcode
Identifier: com.apple.dt.Xcode
Version: 10.1 (14460.46)
Build Info: IDEFrameworks_Fall2018-14460046000000000~5 (10B61)
App Item ID: 497799835
App External ID: 828917606
Code Type: X86-64 (Native)
Parent Process: ??? [1]
Responsible: Xcode [644]
User ID: 869373484
Date/Time: 2020-03-27 13:48:49.845 +0530
OS Version: Mac OS X 10.15.3 (19D76)
Report Version: 12
Anonymous UUID: FD8C88EB-3C2B-91CF-2711-0652F5A776A1
Time Awake Since Boot: 85 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
ProductBuildVersion: 10B61
ASSERTION FAILURE in /Library/Caches/com.apple.xbs/Sources/IDEFrameworks_Fall2018/IDEFrameworks-14460.46/IDEKit/Workspace/IDEWorkspaceDocument.m:3335
Details: selection failed. window: currentlySelectedTabbedWindow:
Object:
Method: -_restoreSelectedTabsByIdentifierFromStateSaving:
Thread: {number = 1, name = main}
Hints:
abort() called
Application Specific Signatures:
window == [window currentlySelectedTabbedWindow]
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x00007fff67ae67fa __pthread_kill + 10
1 libsystem_pthread.dylib 0x00007fff67ba3bc1 pthread_kill + 432
2 libsystem_c.dylib 0x00007fff67a6da1c abort + 120
3 com.apple.dt.IDEKit 0x000000010d960793 +[IDEAssertionHandler _handleAssertionWithLogString:assertionSignature:assertionReason:extraBacktrace:] + 1324
4 com.apple.dt.IDEKit 0x000000010d960dbf -[IDEAssertionHandler handleFailureInMethod:object:fileName:lineNumber:assertionSignature:messageFormat:arguments:] + 1256
5 com.apple.dt.DVTFoundation 0x000000010bd1018a _DVTAssertionHandler + 374
6 com.apple.dt.DVTFoundation 0x000000010bd10463 _DVTAssertionFailureHandler + 374
7 com.apple.dt.IDEKit 0x000000010d889b7a -[IDEWorkspaceDocument _restoreSelectedTabsByIdentifierFromStateSaving:] + 1886
8 com.apple.dt.IDEKit 0x000000010d88594b -[IDEWorkspaceDocument revertStateWithDictionary:] + 267
9 com.apple.dt.DVTFoundation 0x000000010bba380b -[DVTStateToken _pullStateFromDictionary:] + 357
10 com.apple.dt.DVTFoundation 0x000000010bba3bf7 -[DVTStateToken pullStateFromRepository] + 179
11 com.apple.dt.IDEKit 0x000000010d87e2ac -[IDEWorkspaceDocument _readFromURL:ofType:simpleFilesFocused:error:] + 921
12 com.apple.dt.IDEKit 0x000000010d87e88c -[IDEWorkspaceDocument readFromURL:ofType:error:] + 134
13 com.apple.AppKit 0x00007fff2d800db9 -[NSDocument _initWithContentsOfURL:ofType:error:] + 172
14 com.apple.AppKit 0x00007fff2d800ca2 -[NSDocument initWithContentsOfURL:ofType:error:] + 231
15 com.apple.dt.IDEKit 0x000000010dc78b3e -[IDEDocumentController makeDocumentWithContentsOfURL:ofType:error:] + 2064
16 com.apple.AppKit 0x00007fff2da6a91c __97-[NSDocumentController makeDocumentWithContentsOfURL:alternateContents:ofType:completionHandler:]_block_invoke + 91
17 com.apple.AppKit 0x00007fff2da6a8b6 -[NSDocumentController makeDocumentWithContentsOfURL:alternateContents:ofType:completionHandler:] + 160
18 com.apple.AppKit 0x00007fff2d86e8e2 __80-[NSDocumentController openDocumentWithContentsOfURL:display:completionHandler:]_block_invoke + 839
19 com.apple.dt.IDEKit 0x000000010dc7ed59 __145-[IDEDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke + 226
20 com.apple.AppKit 0x00007fff2da69ab8 __144-[NSDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke_4 + 31
21 com.apple.AppKit 0x00007fff2da69e0e __144-[NSDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke_2.872 + 177
22 com.apple.AppKit 0x00007fff2da69cf7 __144-[NSDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke.871 + 153
23 com.apple.AppKit 0x00007fff2da69c0b __144-[NSDocumentController _coordinateReadingAndGetAlternateContentsForOpeningDocumentAtURL:resolvingSymlinks:thenContinueOnMainThreadWithAccessor:]_block_invoke.869 + 243
24 com.apple.AppKit 0x00007fff2da762bf ___NSMainRunLoopPerformBlockInModes_block_invoke + 25
25 com.apple.CoreFoundation 0x00007fff302fb7ab __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
26 com.apple.CoreFoundation 0x00007fff302fb6ed __CFRunLoopDoBlocks + 379
27 com.apple.CoreFoundation 0x00007fff302fa731 __CFRunLoopRun + 1257
28 com.apple.CoreFoundation 0x00007fff302f9bd3 CFRunLoopRunSpecific + 499
29 com.apple.HIToolbox 0x00007fff2ee4f65d RunCurrentEventLoopInMode + 292
30 com.apple.HIToolbox 0x00007fff2ee4f2a9 ReceiveNextEventCommon + 356
31 com.apple.HIToolbox 0x00007fff2ee4f127 _BlockUntilNextEventMatchingListInModeWithFilter + 64
32 com.apple.AppKit 0x00007fff2d4bfba4 _DPSNextEvent + 990
33 com.apple.AppKit 0x00007fff2d4be380 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1352
34 com.apple.dt.DVTKit 0x000000010c376584 -[DVTApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 385
35 com.apple.AppKit 0x00007fff2d4b009e -[NSApplication run] + 658
36 com.apple.AppKit 0x00007fff2d482465 NSApplicationMain + 777
37 com.apple.dt.Xcode 0x000000010ba7e82e main + 574
38 libdyld.dylib 0x00007fff6799f7fd start + 1
I solve this problem by following steps below :
1> Delete DerivedData
2> updates pods if your project have
3> Delete xcUserData from .xcworkspace and .xcproject file .
Solution found on below article please check this for more information.
[https://technuisance.com/xcode/xcode-crash-assertion-failure.html][1]

FIRMessaging client not setup

I've search for some other question/solutions here but can't fix this issue in my App. I can't figure out what is the issue. It was working properly.
When I run my app on Actual Device or on Simulator it crashes on the splash screen. Here is the crash log.
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'FIRMessaging client not setup.'
*** First throw call stack:
(
0 CoreFoundation 0x000000010cfd71bb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010c0f9735 objc_exception_throw + 48
2 CoreFoundation 0x000000010cfd6f42 +[NSException raise:format:arguments:] + 98
3 Foundation 0x0000000109abc940 -[NSAssertionHandler handleFailureInFunction:file:lineNumber:description:] + 166
4 Tarfeeh 0x0000000106e7ee9c -[FIRMessaging connectWithCompletion:] + 556
5 Tarfeeh 0x0000000106dcb573 $S7Tarfeeh11AppDelegateC12connectToFcmyyF + 579
6 Tarfeeh 0x0000000106cd900f $S7Tarfeeh11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF + 2431
7 Tarfeeh 0x0000000106cd97f4 $S7Tarfeeh11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 228
8 UIKitCore 0x000000011290ebde -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280
9 UIKitCore 0x00000001129105cb -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3979
10 UIKitCore 0x0000000112915c2f -[UIApplication _runWithMainScene:transitionContext:completion:] + 1623
11 UIKitCore 0x00000001121344e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866
12 UIKitCore 0x000000011213d29c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153
13 UIKitCore 0x0000000112134126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233
14 UIKitCore 0x0000000112134ae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085
15 UIKitCore 0x0000000112132cb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795
16 UIKitCore 0x000000011213295f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435
17 UIKitCore 0x0000000112137a90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584
18 UIKitCore 0x000000011213880e _performActionsWithDelayForTransitionContext + 100
19 UIKitCore 0x00000001121377ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221
20 UIKitCore 0x000000011213c93a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392
21 UIKitCore 0x000000011291444e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515
22 UIKitCore 0x00000001124b8d09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357
23 FrontBoardServices 0x00000001183da2da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448
24 FrontBoardServices 0x00000001183e5443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271
25 FrontBoardServices 0x00000001183e4b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53
26 libdispatch.dylib 0x000000010f016602 _dispatch_client_callout + 8
27 libdispatch.dylib 0x000000010f019b78 _dispatch_block_invoke_direct + 301
28 FrontBoardServices 0x0000000118419ba8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
29 FrontBoardServices 0x0000000118419860 -[FBSSerialQueue _performNext] + 457
30 FrontBoardServices 0x0000000118419e40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45
31 CoreFoundation 0x000000010cf3c721 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
32 CoreFoundation 0x000000010cf3bf93 __CFRunLoopDoSources0 + 243
33 CoreFoundation 0x000000010cf3663f __CFRunLoopRun + 1263
34 CoreFoundation 0x000000010cf35e11 CFRunLoopRunSpecific + 625
35 GraphicsServices 0x00000001154a61dd GSEventRunModal + 62
36 UIKitCore 0x000000011291781d UIApplicationMain + 140
37 Tarfeeh 0x0000000106cdab44 main + 68
38 libdyld.dylib 0x000000010f08c575 start + 1
39 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
I just updated my podfile and it stopped working. I can't revert back to old version.
Add FirebaseApp.configure() in Your AppDelegate when starting application.
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
}

Proper parameters for closeAllDocumentsWithDelegate

I am writing an app that needs to have multiple documents in one window (as was asked about here. So I can't just make it a "document-based application", but I am still trying to use the document architecture to save the individual files.
What I'm specifically trying to do is close all open documents, and preferably save them if they have been modified. It seems like the best way to do this is to call the closeAllDocumentsWithDelegate method of the shared document controller. But I don't know what parameters to pass it. The docs say it is:
func closeAllDocumentsWithDelegate(_ delegate: AnyObject?,
didCloseAllSelector didCloseAllSelector: Selector,
contextInfo contextInfo: UnsafeMutablePointer)
They don't say what these mean, though. What delegate, selector and contextInfo should I be calling? I can't find examples of this method being used successfully. I tried seeing if I could get away with self and nil just to get it to compile:
SharedDocumentController.sharedDocumentController().closeAllDocumentsWithDelegate(self, didCloseAllSelector: nil, contextInfo: nil)
But then I get the error "Thread 1: EXC_BAD_ACCESS (code=1, address=0x0)", which I'm told is a null pointer exception. So at least one of those nils is a no-go, probably because of a forced unwrap somewhere. Fine, but what would I put there instead?
EDIT: as requested below, I am attaching a pic of the stacktrace:
And of the console:
2016-06-29 12:00:46.397 FourthDraftBrouillon[54275:6093667] An uncaught exception was raised
2016-06-29 12:00:46.397 FourthDraftBrouillon[54275:6093667] *** -[__NSArray0 objectAtIndex:]: index 2 beyond bounds for empty NSArray
2016-06-29 12:00:46.398 FourthDraftBrouillon[54275:6093667] (
0 CoreFoundation 0x00007fff981034f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff888b8f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff98123205 -[__NSArray0 objectAtIndex:] + 101
3 libswiftCore.dylib 0x0000000100075f4d _TFVs12_ArrayBuffer19_getElementSlowPathfSiPs9AnyObject_ + 125
4 libswiftCore.dylib 0x0000000100075370 _TFVs12_ArrayBuffer10getElementfTSi20wasNativeTypeCheckedSb_x + 144
5 libswiftCore.dylib 0x000000010008e60a _TFSag9subscriptFSix + 138
6 FourthDraftBrouillon 0x0000000100007c6f _TFC20FourthDraftBrouillon14ViewController14collectionViewfTCSo16NSCollectionView35itemForRepresentedObjectAtIndexPathCSo11NSIndexPath_CSo20NSCollectionViewItem + 799
7 FourthDraftBrouillon 0x0000000100007e2f _TToFC20FourthDraftBrouillon14ViewController14collectionViewfTCSo16NSCollectionView35itemForRepresentedObjectAtIndexPathCSo11NSIndexPath_CSo20NSCollectionViewItem + 79
8 AppKit 0x00007fff92bc40f6 -[_NSCollectionViewDataSourceAdapter collectionView:itemForRepresentedObjectAtIndexPath:] + 487
9 UIFoundation 0x00007fff95acd3ff -[_NSCollectionViewCore _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 81
10 UIFoundation 0x00007fff95ace6f6 -[_NSCollectionViewCore _updateVisibleCellsNow:] + 2167
11 UIFoundation 0x00007fff95ad0b24 -[_NSCollectionViewCore _layoutItems] + 208
12 AppKit 0x00007fff92bb76aa -[NSCollectionView layout] + 80
13 AppKit 0x00007fff923f14eb -[NSView _doLayout] + 53
14 AppKit 0x00007fff923f11a3 -[NSView _layoutSubtreeWithOldSize:] + 324
15 AppKit 0x00007fff923f13ff -[NSView _layoutSubtreeWithOldSize:] + 928
16 AppKit 0x00007fff923f13ff -[NSView _layoutSubtreeWithOldSize:] + 928
17 AppKit 0x00007fff923f13ff -[NSView _layoutSubtreeWithOldSize:] + 928
18 AppKit 0x00007fff923f13ff -[NSView _layoutSubtreeWithOldSize:] + 928
19 AppKit 0x00007fff923f06dc -[NSView layoutSubtreeIfNeeded] + 950
20 AppKit 0x00007fff92410025 -[NSWindow(NSConstraintBasedLayout) _layoutViewTree] + 82
21 AppKit 0x00007fff92482603 -[NSWindow(NSConstraintBasedLayout) layoutIfNeeded] + 244
22 AppKit 0x00007fff92b191f5 ___NSWindowGetDisplayCycleObserver_block_invoke6358 + 218
23 AppKit 0x00007fff924945fc __37+[NSDisplayCycle currentDisplayCycle]_block_invoke + 719
24 QuartzCore 0x00007fff91702f71 _ZN2CA11Transaction19run_commit_handlersE18CATransactionPhase + 85
25 QuartzCore 0x00007fff9170242c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 160
26 QuartzCore 0x00007fff917020ec _ZN2CA11Transaction6commitEv + 508
27 AppKit 0x00007fff925d9650 -[_NSScrollingConcurrentMainThreadSynchronizer _synchronize:completionHandler:] + 391
28 AppKit 0x00007fff925d9496 __80-[_NSScrollingConcurrentMainThreadSynchronizer initWithSharedData:constantData:]_block_invoke + 144
29 libdispatch.dylib 0x00000001005cbcc5 _dispatch_client_callout + 8
30 libdispatch.dylib 0x00000001005deba6 _dispatch_source_latch_and_call + 3387
31 libdispatch.dylib 0x00000001005d0cd8 _dispatch_source_invoke + 978
32 libdispatch.dylib 0x00000001005e3012 _dispatch_main_queue_callback_4CF + 1153
33 CoreFoundation 0x00007fff980b89e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
34 CoreFoundation 0x00007fff980778dd __CFRunLoopRun + 1949
35 CoreFoundation 0x00007fff98076ed8 CFRunLoopRunSpecific + 296
36 HIToolbox 0x00007fff89e0b935 RunCurrentEventLoopInMode + 235
37 HIToolbox 0x00007fff89e0b76f ReceiveNextEventCommon + 432
38 HIToolbox 0x00007fff89e0b5af _BlockUntilNextEventMatchingListInModeWithFilter + 71
39 AppKit 0x00007fff9233cefa _DPSNextEvent + 1067
40 AppKit 0x00007fff9233c32a -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
41 AppKit 0x00007fff92330e84 -[NSApplication run] + 682
42 AppKit 0x00007fff922fa46c NSApplicationMain + 1176
43 FourthDraftBrouillon 0x0000000100008d04 main + 84
44 libdyld.dylib 0x00007fff930135ad start + 1
45 ??? 0x0000000000000003 0x0 + 3
)
2016-06-29 12:00:46.399 FourthDraftBrouillon[54275:6093667] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArray0 objectAtIndex:]: index 2 beyond bounds for empty NSArray'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff981034f2 __exceptionPreprocess + 178
1 libobjc.A.dylib 0x00007fff888b8f7e objc_exception_throw + 48
2 CoreFoundation 0x00007fff98123205 -[__NSArray0 objectAtIndex:] + 101
3 libswiftCore.dylib 0x0000000100075f4d _TFVs12_ArrayBuffer19_getElementSlowPathfSiPs9AnyObject_ + 125
4 libswiftCore.dylib 0x0000000100075370 _TFVs12_ArrayBuffer10getElementfTSi20wasNativeTypeCheckedSb_x + 144
5 libswiftCore.dylib 0x000000010008e60a _TFSag9subscriptFSix + 138
6 FourthDraftBrouillon 0x0000000100007c6f _TFC20FourthDraftBrouillon14ViewController14collectionViewfTCSo16NSCollectionView35itemForRepresentedObjectAtIndexPathCSo11NSIndexPath_CSo20NSCollectionViewItem + 799
7 FourthDraftBrouillon 0x0000000100007e2f _TToFC20FourthDraftBrouillon14ViewController14collectionViewfTCSo16NSCollectionView35itemForRepresentedObjectAtIndexPathCSo11NSIndexPath_CSo20NSCollectionViewItem + 79
8 AppKit 0x00007fff92bc40f6 -[_NSCollectionViewDataSourceAdapter collectionView:itemForRepresentedObjectAtIndexPath:] + 487
9 UIFoundation 0x00007fff95acd3ff -[_NSCollectionViewCore _createPreparedCellForItemAtIndexPath:withLayoutAttributes:applyAttributes:] + 81
10 UIFoundation 0x00007fff95ace6f6 -[_NSCollectionViewCore _updateVisibleCellsNow:] + 2167
11 UIFoundation 0x00007fff95ad0b24 -[_NSCollectionViewCore _layoutItems] + 208
12 AppKit 0x00007fff92bb76aa -[NSCollectionView layout] + 80
13 AppKit 0x00007fff923f14eb -[NSView _doLayout] + 53
14 AppKit 0x00007fff923f11a3 -[NSView _layoutSubtreeWithOldSize:] + 324
15 AppKit 0x00007fff923f13ff -[NSView _layoutSubtreeWithOldSize:] + 928
16 AppKit 0x00007fff923f13ff -[NSView _layoutSubtreeWithOldSize:] + 928
17 AppKit 0x00007fff923f13ff -[NSView _layoutSubtreeWithOldSize:] + 928
18 AppKit 0x00007fff923f13ff -[NSView _layoutSubtreeWithOldSize:] + 928
19 AppKit 0x00007fff923f06dc -[NSView layoutSubtreeIfNeeded] + 950
20 AppKit 0x00007fff92410025 -[NSWindow(NSConstraintBasedLayout) _layoutViewTree] + 82
21 AppKit 0x00007fff92482603 -[NSWindow(NSConstraintBasedLayout) layoutIfNeeded] + 244
22 AppKit 0x00007fff92b191f5 ___NSWindowGetDisplayCycleObserver_block_invoke6358 + 218
23 AppKit 0x00007fff924945fc __37+[NSDisplayCycle currentDisplayCycle]_block_invoke + 719
24 QuartzCore 0x00007fff91702f71 _ZN2CA11Transaction19run_commit_handlersE18CATransactionPhase + 85
25 QuartzCore 0x00007fff9170242c _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 160
26 QuartzCore 0x00007fff917020ec _ZN2CA11Transaction6commitEv + 508
27 AppKit 0x00007fff925d9650 -[_NSScrollingConcurrentMainThreadSynchronizer _synchronize:completionHandler:] + 391
28 AppKit 0x00007fff925d9496 __80-[_NSScrollingConcurrentMainThreadSynchronizer initWithSharedData:constantData:]_block_invoke + 144
29 libdispatch.dylib 0x00000001005cbcc5 _dispatch_client_callout + 8
30 libdispatch.dylib 0x00000001005deba6 _dispatch_source_latch_and_call + 3387
31 libdispatch.dylib 0x00000001005d0cd8 _dispatch_source_invoke + 978
32 libdispatch.dylib 0x00000001005e3012 _dispatch_main_queue_callback_4CF + 1153
33 CoreFoundation 0x00007fff980b89e9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
34 CoreFoundation 0x00007fff980778dd __CFRunLoopRun + 1949
35 CoreFoundation 0x00007fff98076ed8 CFRunLoopRunSpecific + 296
36 HIToolbox 0x00007fff89e0b935 RunCurrentEventLoopInMode + 235
37 HIToolbox 0x00007fff89e0b76f ReceiveNextEventCommon + 432
38 HIToolbox 0x00007fff89e0b5af _BlockUntilNextEventMatchingListInModeWithFilter + 71
39 AppKit 0x00007fff9233cefa _DPSNextEvent + 1067
40 AppKit 0x00007fff9233c32a -[NSApplication _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 454
41 AppKit 0x00007fff92330e84 -[NSApplication run] + 682
42 AppKit 0x00007fff922fa46c NSApplicationMain + 1176
43 FourthDraftBrouillon 0x0000000100008d04 main + 84
44 libdyld.dylib 0x00007fff930135ad start + 1
45 ??? 0x0000000000000003 0x0 + 3
)
libc++abi.dylib: terminating with uncaught exception of type NSException
This method simply executes -canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo: for all open windows. So look at its documentation. (Linked above.)
The short form: You can pass a delegate object, which will be informed about the close request via the method that responds to the selector, you passed.
So let's say, the object that should be informed is the app delegate, then you pass this as delegate parameter and write a method in the app delegate, whose selector you pass as selector parameter. In Swift you must decorate that method (Swift: function) with #objc.
The contextInfo is any user-definable data to pass or not. It is simply passed through. It is a "communication channel" from caller in your code to the delegate method, i. e. signaling the reason for the close. You can pass nil for it.
Even I did not test it, but typically you can pass nil for delegate, too. In such a case you should be able to pass NULL (it is no type) for the selector. Just try it. Then you do not need an empty method.