別のプログラム内にプラグインとしてロードされているNSString
内からペーストボードにをコピーしようとしています。NSBundle
何らかの理由で、[NSPasteboard generalPasteboard]
nil が返されます。
私のコードは、Apple のNSPasteboard ドキュメントとNSPasteboard プログラミング ガイドからのものです。
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
// Outputs: (null)
NSLog(@"%@", pasteboard);
[pasteboard clearContents];
BOOL copiedToPasteboard = [pasteboard writeObjects:@[@"The string"]];
これを引き起こすために私がうっかりしてしまった可能性のあることはありますか?