을 NSBundle
내에서 페이스트 보드로 복사하려고합니다.이 프로그램은 다른 프로그램 내부에 플러그인으로로드됩니다.NSPasteboard generalPasteboard는 nil을 반환합니다
어떤 이유로 든 [NSPasteboard generalPasteboard]
이 nil을 반환합니다.
내 코드는 애플의 NSPasteboard documentation 및 NSPasteboard programming guide에서입니다 :
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
// Outputs: (null)
NSLog(@"%@", pasteboard);
[pasteboard clearContents];
BOOL copiedToPasteboard = [pasteboard writeObjects:@[@"The string"]];
내가 부주의를 유발했을 수있는 일이 있습니까?
Mac 용으로 개발 중이십니까? – samfisher
@samfisher 예, 제 질문은 '코코아'에 관한 것입니다. –
ARC를 사용하고 있습니까? 그것은 컴파일러 버그 일 수 있습니다 ... –