0

Trying to create some alias file into a directory, but I got NSCocoaErrorDomain - code: 512. I have read and write access to the source directory, but no write access to the destination directory.

Source directory: - source file

Destination directory: - alias (links to the source file)

NSError *error = nil;
NSData *data = [src bookmarkDataWithOptions:NSURLBookmarkCreationWithSecurityScope
                        includingResourceValuesForKeys:nil
                                         relativeToURL:nil
                                                 error:&error];
if(data != nil)
    [NSURL writeBookmarkData:data toURL:dest options:NSURLBookmarkCreationWithSecurityScope error:&error];

If I create a folder or a file manually inside the destination directory, OS X asks me for the admin password:

enter image description here

3ef9g
  • 781
  • 2
  • 9
  • 19
  • http://stackoverflow.com/questions/18711049/creating-a-security-scope-bookmark-for-a-file-from-one-of-a-directory-containing – john elemans Dec 19 '16 at 21:14
  • @johnelemans don't see how this should help me =( I only found a way to execute some apple script with administration privileges http://stackoverflow.com/a/8865284/4299534 but there must be a way to do it with objective-c – 3ef9g Dec 20 '16 at 09:25
  • Does somebody has experience with https://developer.apple.com/library/content/documentation/Security/Conceptual/authorization_concepts/ – 3ef9g Dec 20 '16 at 09:31

0 Answers0