Short question upfront: is there any difference between macOS 10.12 and 10.14 in the way I should treat security scoped bookmarks?
More specifically: In my sandboxed app (actually, it is a screensaver), I store a directory, which the user selects, in the user's defaults using a security scoped bookmark (SSB). When the screensaver is running later again, it reads that SSB and retrieves the files in the directory. Everything works fine under macOS 10.14 and 10.15 . However, one user has reported that it does not work under macOS 10.12 (Sierra). (I guess he is the only one still running 10.12) In fact, when I try to resolve the SSB, I get the error message Error: Error Domain=NSCocoaErrorDomain Code=259 "The file couldn’t be opened because it isn’t in the correct format." Below, you can find my code with which I resolve an SSB. My question is: is there any difference between macOS 10.12 and 10.14 in the way I should treat SSB's? One of the symptoms is that the screensaver runs fine in System Preferences , which is to be expected since SystemPreferences has access to all the files in the user's home anyways under Sierra (IIRC). But when the screensaver runs standalone, i.e., it is part of the ScreenSaverEngine process, then obviously it no longer has access to all the user's files. And this is when the error occurs. Any hints and ideas will be appreciated! Best regards, Gabriel Encl: This is my code to resolve a SSB NSURL * dir_location = [NSURL URLByResolvingBookmarkData: bookmark options: NSURLBookmarkResolutionWithSecurityScope relativeToURL: nil bookmarkDataIsStale: & isStale error: & error]; At this point, I get dir_location=NIL, then I print the error. (Code=259) This is my code to create a SSB: NSData * dir_bookmark = [dir bookmarkDataWithOptions: NSURLBookmarkCreationWithSecurityScope includingResourceValuesForKeys: nil relativeToURL: nil error: &systemError]; This seems to work (always), as dir_bookmark is never NIL.
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com