• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Security-scoped bookmark and screensaver
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Security-scoped bookmark and screensaver


  • Subject: Security-scoped bookmark and screensaver
  • From: Gabriel Zachmann via Cocoa-dev <email@hidden>
  • Date: Wed, 3 Jan 2024 13:20:31 +0100

From one of the users of my screensaver, I get the issue report that resolving
the SSB does not work.
He is running macOS 10.14.6 on a Mac Mini.
I have compiled my screensaver using the current version of Xcode, under macOS
14, but for the target macOS 10.13.

When my screensaver tries to resolve the bookmark, I get the infamous
  Code%9 "The File couldn't be opened because it isn't in the correct format."

This happens, when my screensaver is launched by the ScreenSaverEngine.
When my screensaver is running in System Preferences, in the thumbnail window,
everything is fine, and resolving the bookmark works, of course.
Also, there are other users of my screensaver (including me), where it runs
just fine.

For that user, the directory for which my screensaver creates the bookmark is
on an external HD.

Below is the source code showing how I create/resolve bookmarks.

Any ideas what I could try (or the user) will be highly appreciated.

Best regards, Gabriel


Create bookmark:

        NSData * dir_bookmark = [dir bookmarkDataWithOptions:
NSURLBookmarkCreationWithSecurityScope
                               includingResourceValuesForKeys: nil
                                                relativeToURL: nil
                                                        error: &systemError];

[no problems occur here]


Resolve bookmark:

        NSURL * dir_location = [NSURL URLByResolvingBookmarkData: bookmark
                                                       options:
NSURLBookmarkResolutionWithSecurityScope
                                                 relativeToURL: nil
                                           bookmarkDataIsStale: & isStale
                                                         error: & error];

[at this point, dir_location == nil, and I get the error code 259.
I can still extract the path using this code:

            NSDictionary * dict = [NSURL resourceValuesForKeys: [NSArray
arrayWithObjects: NSURLPathKey, nil]
                                              fromBookmarkData: bookmark ];
            .. = [NSString stringWithFormat: @"Orig path: %@", [dict
objectForKey: NSURLPathKey];


Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Accessibility Settings
      • From: Tom Doan via Cocoa-dev <email@hidden>
    • Re: Security-scoped bookmark and screensaver
      • From: Steve Mills via Cocoa-dev <email@hidden>
  • Next by Date: Re: Security-scoped bookmark and screensaver
  • Next by thread: Re: Security-scoped bookmark and screensaver
  • Index(es):
    • Date
    • Thread