Skip to content

macOS Sequoia "Domain name cannot be nil or empty" #164

Closed
@inflex

Description

@inflex

Hopefully not wasting people's time here.

I've noticed people using my program on macOS Sequoia, either Intel or ARM are unable now to use the Save-As / Open / Folder-select NFD's and best I can see there's an error presented in the "Console".

The program itself reports "picker_folder: selection cancelled".

No issues with the code in prior macOS releases (and this is built on Catalina Intel)

Unable to display open panel (unrecognized error: Error Domain=com.apple.ViewBridge Code=14 "(null)" UserInfo={com.apple.ViewBridge.error.hint=-[NSViewServiceMarshal bootstrap:withReply:] caught NSInvalidArgumentException '*** -[NSUserDefaults setObject:forKey:inDomain:]: domain name cannot be nil or empty' with backtrace (
    "0   CoreFoundation                      __exceptionPreprocess + 176",
    "1   libobjc.A.dylib                     objc_exception_throw + 88",
    "2   Foundation                          -[NSUserDefaults(NSUserDefaults) setObject:forKey:inDomain:] + 420",
    "3   AppKit                              +[NSOSPDefaults _readFileListModeForIdentifier:inSaveMode:inDirectory:lastListForMediaBrowserMode:] + 524",
    "4   AppKit                              -[NSRemoteSavePanel(NSSavePanelLayout) _makeFinderKitView] + 416",
    "5   AppKit                              -[NSRemoteSavePanel(NSSavePanelLayout) _setupFileBrowserView] + 68",
    "6   AppKit                              -[NSRemoteSavePanel(NSSavePanelLayout) _initContentView] + 1544",
    "7   AppKit                              -[NSRemoteSavePanel initWithContentRect:styleMask:backing:defer:] + 488",
    "8   AppKit                              -[NSRemoteSavePanel initWithOptions:] + 476",
    "9   com.apple.appkit.xpc.openAndSavePan main + 708",
    "10  com.apple.appkit.xpc.openAndSavePan com.apple.appkit.xpc.openAndSavePan + 6440",
    "11  AppKit                              -[NSViewController _loadViewIfRequired] + 72",
    "12  AppKit                              __24-[NSViewController view]_block_invoke + 28",
    "13  AppKit                              NSPerformVisuallyAtomicChange + 108",
    "14  AppKit                              -[NSViewController view] + 160",
    "15  ViewBridge                          -[NSViewServiceMarshal _bootstrap:replyData:completion:] + 1308",
    "16  ViewBridge                          -[NSViewServiceMarshal bootstrap:withReply:] + 272",
    "17  CoreFoundation                      __invoking___ + 148",
    "18  CoreFoundation                      -[NSInvocation invoke] + 424",
    "19  CoreFoundation                      -[NSInvocation invokeWithTarget:] + 64",
    "20  ViewBridge                          -[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 192",
    "21  CoreFoundation                      ___forwarding___ + 956",
    "22  CoreFoundation                      _CF_forwarding_prep_0 + 96",
    "23  CoreFoundation                      __invoking___ + 148",
    "24  CoreFoundation                      -[NSInvocation invoke] + 424",
    "25  CoreFoundation                      -[NSInvocation invokeWithTarget:] + 64",
    "26  ViewBridge                          -[NSVB_QueueingProxy forwardInvocation:] + 308",
    "27  CoreFoundation                      ___forwarding___ + 956",
    "28  CoreFoundation                      _CF_forwarding_prep_0 + 96",
    "29  CoreFoundation                      __invoking___ + 148",
    "30  CoreFoundation                      -[NSInvocation invoke] + 424",
    "31  CoreFoundation                      -[NSInvocation invokeWithTarget:] + 64",
    "32  CoreFoundation                      ___forwarding___ + 956",
    "33  CoreFoundation                      _CF_forwarding_prep_0 + 96",
    "34  CoreFoundation                      __invoking___ + 148",
    "35  CoreFoundation                      -[NSInvocation invoke] + 424",
    "36  ViewBridge                          __deferNSXPCInvocationOntoMainThread_block_invoke + 132",
    "37  ViewBridge                          __wrapBlockWithVoucher_block_invoke + 56",
    "38  ViewBridge                          deferredBlockOpportunity_block_invoke_2 + 356",
    "39  CoreFoundation                      __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 28",
    "40  CoreFoundation                      __CFRunLoopDoBlocks + 352",
    "41  CoreFoundation                      __CFRunLoopRun + 2384",
    "42  CoreFoundation                      CFRunLoopRunSpecific + 572",
    "43  HIToolbox                           RunCurrentEventLoopInMode + 324",
    "44  HIToolbox                           ReceiveNextEventCommon + 676",
    "45  HIToolbox                           _BlockUntilNextEventMatchingListInModeWithFilter + 76",
    "46  AppKit                              _DPSNextEvent + 684",
    "47  AppKit                              -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688",
    "48  ViewBridge                          __77-[NSViewServiceApplication vbNextEventMatchingMask:untilDate:inMode:dequeue:]_block_invoke + 148",
    "49  ViewBridge                          -[NSViewServiceApplication _withToxicEventMonitorPerform:] + 152",
    "50  ViewBridge                          -[NSViewServiceApplication vbNextEventMatchingMask:untilDate:inMode:dequeue:] + 168",
    "51  ViewBridge                          -[NSViewServiceApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 100",
    "52  AppKit                              -[NSApplication run] + 480",
    "53  AppKit                              NSApplicationMain + 880",
    "54  libxpc.dylib                        _xpc_objc_main + 816",
    "55  libxpc.dylib                        _xpc_main + 40",
    "56  libxpc.dylib                        _xpc_copy_xpcservice_dictionary + 0",
    "57  ViewBridge                          xpc_connection_handler + 0",
    "58  ViewBridge                          NSViewServiceMain + 360",
    "59  com.apple.appkit.xpc.openAndSavePan main + 156",
    "60  dyld                                start + 6000"
), com.apple.ViewBridge.error.description=NSViewBridgeErrorServiceBootstrap})

Function that is called is this...

std::filesystem::path BoardView::picker_folder( std::filesystem::path defaultPath ){

	char dp[4096];

	std::filesystem::path filename;
	NFD_Init();
	nfdpickfolderu8args_t args = { NULL,  { 0, NULL } };
	nfdu8char_t *outPath;

	filename.clear();

	if (!defaultPath.empty()) {
		snprintf(dp, sizeof(dp), "%s", defaultPath.string().c_str());
		args.defaultPath = dp;
	} else {
		snprintf(dp, sizeof(dp), "%s", cwd.string().c_str());
		args.defaultPath = dp;
	}

	NFD_GetNativeWindowFromSDLWindow(mainWindow /* SDL_Window* */, &args.parentWindow);
	nfdresult_t result = NFD_PickFolderU8_With(&outPath, &args);
	if (result == NFD_OKAY)
	{
		filename = outPath;
		flog("picker_folder: '%s' selected\n", filename.string().c_str());
		NFD_FreePathU8(outPath);
	}
	else if (result == NFD_CANCEL)
	{
		flog("picker_folder: selection cancelled\n");
	}
	else 
	{
		flog("picker_folder: ERROR\n");
	}

	NFD_Quit();

	return filename;

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions