I cannot get this method to return YES:
- (BOOL) writeToPasteBoard:(NSString *)stringToWrite { return [pasteBoard setString:stringToWrite forType:NSStringPboardType]; }
I have verified that stringToWrite is coming through properly, the method just always returns NO.
Any ideas?
Here is the rest of the class:
@interface ClipBoard : NSObject { NSPasteboard *pasteBoard; } - (BOOL) writeToPasteBoard:(NSString *)stringToWrite; - (NSString *) readFromPasteBoard; @end @implementation ClipBoard - (id) init { [super init]; pasteBoard = [NSPasteboard generalPasteboard]; return self; } - (BOOL) writeToPasteBoard:(NSString *)stringToWrite { return [pasteBoard setString:stringToWrite forType:NSStringPboardType]; } - (NSString *) readFromPasteBoard { return [pasteBoard stringForType:NSStringPboardType]; }
@end
Here is the working version of the method: