NSPersistentDocument: *** Assertion failure in -[NSVBSavePanel viewWillInvalidate:]
If you get the following error when saving your new NSPersistentDocument:
2017-09-17 21:14:30.531466+0200 TST_NSPersistentDocument_Override_MC[57707:11669067] *** Assertion failure in -[NSVBSavePanel viewWillInvalidate:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561/Nav.subproj/OpenAndSavePanelRemote/NSVBOpenAndSavePanels.m:387 2017-09-17 21:14:30.543482+0200 TST_NSPersistentDocument_Override_MC[57707:11669067] -[NSVBSavePanel init] caught non-fatal NSInternalInconsistencyException 'bridge absent' with backtrace ( 0 CoreFoundation 0x00007fff283360fb __exceptionPreprocess + 171 1 libobjc.A.dylib 0x00007fff4ebe4c76 objc_exception_throw + 48 2 CoreFoundation 0x00007fff2833be92 +[NSException raise:format:arguments:] + 98 3 Foundation 0x00007fff2a3d2690 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4 AppKit 0x00007fff25b3ec4e -[NSVBSavePanel viewWillInvalidate:] + 188 5 ViewBridge 0x00007fff4c551cb3 -[NSRemoteView invalidate:] + 292 6 ViewBridge 0x00007fff4c55f449 -[NSRemoteView _advanceToConfigPhaseLegacy] + 1111 7 ViewBridge 0x00007fff4c5602dc -[NSRemoteView _viewServiceMarshalProxy:withDetailedErrorHandler:] + 230 8 ViewBridge 0x00007fff4c5606c5 -[NSRemoteView _viewServiceMarshalProxy:withErrorHandler:] + 78 9 ViewBridge 0x00007fff4c552755 -[NSRemoteView bridge] + 227 10 AppKit 0x00007fff25afa5f6 -[NSVBSavePanel init] + 292 11 AppKit 0x00007fff25afa1a1 +[NSSavePanel _crunchyRawUnbonedPanel] + 72 12 AppKit 0x00007fff2646c0ba -[NSDocument(NSDocumentSaving) _preparedSavePanelForOperation:] + 263 13 AppKit 0x00007fff2646cb1c __104-[NSDocument(NSDocumentSaving) _runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:]_block_invoke_2 + 317 14 AppKit 0x00007fff25c0180a -[NSDocument _commitEditingThenContinue:] + 472 15 AppKit 0x00007fff25f97481 __62-[NSPersistentDocument _documentEditor:didCommit:withContext:]_block_invoke + 52 16 CoreFoundation 0x00007fff282ce52c __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12 17 CoreFoundation 0x00007fff282b0f43 __CFRunLoopDoBlocks + 275 18 CoreFoundation 0x00007fff282b0d08 __CFRunLoopRun + 3128 19 CoreFoundation 0x00007fff282afe43 CFRunLoopRunSpecific + 483 20 HIToolbox 0x00007fff275cf866 RunCurrentEventLoopInMode + 286 21 HIToolbox 0x00007fff275cf5d6 ReceiveNextEventCommon + 613 22 HIToolbox 0x00007fff275cf354 _BlockUntilNextEventMatchingListInModeWithFilter + 64 23 AppKit 0x00007fff258cd44f _DPSNextEvent + 2085 24 AppKit 0x00007fff26062508 -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 3044 25 AppKit 0x00007fff258c225d -[NSApplication run] + 764 26 AppKit 0x00007fff258913fe NSApplicationMain + 804 27 TST_NSPersistentDocument_Override_MC 0x000000010000379d main + 13 28 libdyld.dylib 0x00007fff4f7d3145 start + 1 29 ??? 0x0000000000000003 0x0 + 3 )
This is due to the fact that, by default, Xcode only adds the "Read Only" permission to "User Selected File".
Change it your Target > Capabilities > App Sandbox settings and rebuild!