I’m attempting to copy an NSString to the pasteboard from within an NSBundle that is loaded inside another program as a plugin.
For some reason, [NSPasteboard generalPasteboard] is returning nil.
My code is from Apple’s NSPasteboard documentation and NSPasteboard programming guide:
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
// Outputs: (null)
NSLog(@"%@", pasteboard);
[pasteboard clearContents];
BOOL copiedToPasteboard = [pasteboard writeObjects:@[@"The string"]];
Is there something I could have inadvertently done to cause this?
My problem was solved by reinstalling my OS.
I can only assume that something, somewhere, at some time became corrupted, causing this infuriating issue.