私はファイルパスとさまざまなタイプのさまざまな組み合わせを試して髪を引き裂いてきましたが、基本的に私がやろうとしているのは、リソースフォルダー内にある「test」というフォルダーをコピーすることです。
NSPasteBoard
絶対パス(例:/ Users / dw / src / Menulet)を指定すると、フォルダーのコピーが機能しますが、mainBundleのリソースパスを使用しようとすると機能しません。これが私が現在持っているコードです:
NSString *resourceFolder = [[NSURL fileURLWithPath:[[NSBundle mainBundle]
resourcePath]] absoluteString];
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
[pboard declareTypes:[NSArray arrayWithObject:NSURLPboardType] owner:nil];
NSString *SDKPathString = [[NSString alloc] initWithFormat:@"%@test/",
resourceFolder];
NSURL *SDKPathURL = [[NSURL alloc] initWithString:SDKPathString];
[pboard writeObjects:[NSArray arrayWithObject:SDKPathURL]];
その結果、ファイルが見つかりません。
__CFPasteboardIssueSandboxExtensionForPath: error for [/Users/dw/Library/Developer/Xcode/DerivedData/Menulet-bvwpfkjlcufhxubvaxubgnubtfgi/Build/Products/Debug/Menulet.app/Contents/Resources/test]
ディレクトリをコピーするにはどうすればよいですか?
編集: