I have an application that copies files to the clipboard. Here is the relevant code (the arguments are an NSStrings array containing file paths):
NSMutableArray *filesToCopy = [[NSMutableArray alloc] init];
int i;
for (i=1; i < [arguments count]; i++) {
NSString* pathToFile = [arguments objectAtIndex:i];
NSURL* fileURL = [[NSURL alloc] initFileURLWithPath:pathToFile];
[filesToCopy addObject:fileURL];
}
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
NSInteger changeCount = [pasteboard clearContents];
BOOL OK = [pasteboard writeObjects:filesToCopy];
However, when testing, when trying to paste a file copied to the clipboard of the program into an empty e-mail in Mail, the file is often displayed as zero bytes, and the following error appears on the console:
11/13/13 6: 27: 12.173 AM Mail [627]: Failed to get the valid sandbox extension for item: [789514] flavor: [public.file-url] from cardboard. 11/13/13 6: 27: 12.174 AM Mail [627]: Failed to get sandbox extensions for itemIdentifier (789514). Sandbox extension data was NULL
and then it follows the following error on the console:
11/13/13 8: 24: 41.947 AM sandboxd [172]: ([627]) Mail (627) deny file-read-xattr [ ]
, Finder, , . , - Finder , , . , AppleScript . , , :
{{ "class furl", 115}, { "class utf8", 115}, { "class ut16", 232}, {string, 115}, {Unicode text, 230}}
, Finder, Applescript :
{{ " furl", 33}, { " icns", 795020}, { " ut16", 112}, { " utf8", 55}, { "class 8BPS", 1630436}, { " BMP", 4194358}, { " TPIC", 1059291}, {TIFF picture, 4197954}, { " PNGf", 392648}, { " jp2", 213480}, {GIF-, 121307}, { JPEG, 116181}, {Unicode text, 110}, {string, 55}}
, Finder . , furl . , , , Mail , Finder, , .
, , ? , Finder NSURL, , . , furl , . , .