[NSURL bookmarkDataWithOptions:] fails on OS X 10.8

I have the following code to save user selected URL as bookmark:


#define kBOOKMARK_OPTIONS_SAVE 
(NSURLBookmarkCreationWithSecurityScope | NSURLBookmarkCreationSecurityScopeAllowOnlyReadAccess)

NSData* bookmark = [url bookmarkDataWithOptions:kBOOKMARK_OPTIONS_SAVE includingResourceValuesForKeys:nil relativeToURL:nil error:&error];


This works fine on OS X 10.9+ but always fails on 10.8. But the docs say this method is available in OS X v10.6 and later.


EDIT:

The error on 10.8 is - Error Code=256, The file "test.db" couldn't be opened.

What is kBOOKMARK_OPTIONS_SAVE? Log the "url" variable and show us the result. Also, when the method fails, log the error variable and show that, too.

[NSURL bookmarkDataWithOptions:] fails on OS X 10.8
 
 
Q