"Failed to update [sic] bookmark for item" in call [NSOpenPanel openPanel]

My Mac is intended for editing and analyzing graphs that users can create and store in files anywhere in the file system. I go to the user to allow them to open a previously created file with [NSOpenPanel openPanel] and the built-in completion handler block. During menu processing, I get this console error message several times:

 2017-02-25 13:42:47.394433 pasteurnet3[32901:1263849] [default] Failed to updated bookmark for item (null) [60AF512E-6072-427D-8624-C406B0EF7D5A] - URL:file:///AirDrop with error Error Domain=NSCocoaErrorDomain Code=260 "The file couldn't be opened because it doesn't exist." 

This only happens when creating an NSOpenPanel , even before sending the beginWithCompletionHandler: message. FWIW, however, the menu appears when it is finally requested, allows you to select a file, and seems to work. There seems to be a long delay in initializing the menu object.

I have not paid attention to this application for a long time, but the appearance of the message appears to be due to a change in MacOS. I immediately suspected the sandbox, but the sandbox was disabled for the application. If I turn on the sandbox and request the rights to the "User File", this does not seem to matter.

There is nothing special about creating an object, except that it runs inside the @try block:

 @try { // Create the File Open Dialog class. openDialog_ = [NSOpenPanel openPanel]; // error occurs here } @catch (NSException *e){ NSLog(@"innocuous exception(1) in -initForOpenWithDefaultFile:callBackTo:"); } @catch (NSString *s){ NSLog(@"innocuous exception(2) in -initForOpenWithDefaultFile:callBackTo: \"%@\"", s); } @catch (...) { NSLog(@"innocuous exception(3) in -initForOpenWithDefaultFile:callBackTo: probably a layout error"); } @finally { ; } 

I do nothing with bookmarks from the program and, for that matter, with AirDrop.

Xcode 8.2.1, Macbook MacOS 10.12.3.

+5
source share
1 answer

For me, โ€œFailed to update the bookmark for the item (null)โ€ was registered at startup when the elements for the files that I opened and then deleted in Finder were saved in my application File> Open Last Menu. I donโ€™t know if there is a way for the menu to simply delete items, but I got rid of the messages by choosing File> Open Recently> Clear Menu while my application is running.

My application does not use NSDocument. I add items to open Recent using -noteNewRecentDocumentURL.

+1
source

Source: https://habr.com/ru/post/1264715/


All Articles