[pasteboard declareTypes] needs to be called before every time you set a string to the pasteboard.

This commit is contained in:
Grant Limberg 2016-08-09 18:03:48 -07:00
parent 8ae07fb9c9
commit 91b8d6f34f
2 changed files with 3 additions and 6 deletions

View File

@ -31,8 +31,6 @@
@property (nonatomic) NodeStatus *status;
@property (nonatomic) NSPasteboard *pasteboard;
- (void)buildMenu;
- (void)onNetworkListUpdated:(NSNotification*)note;

View File

@ -28,9 +28,6 @@
self.monitor = [[NetworkMonitor alloc] init];
self.networks = [NSMutableArray<Network*> array];
self.status = nil;
self.pasteboard = [NSPasteboard generalPasteboard];
[self.pasteboard declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSDictionary *defaultsDict = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:@"firstRun"];
@ -266,7 +263,9 @@
- (void)copyNodeID {
if(self.status != nil) {
[self.pasteboard setString:self.status.address forType:NSPasteboardTypeString];
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
[pasteboard declareTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil];
[pasteboard setString:self.status.address forType:NSPasteboardTypeString];
}
}