Hello all.
I have some code which read buffer and write this value in variable, but on the second iteration of timer i get out of memory exception, what is mean?
Thanks.
- (void)applicationDidFinishLaunching
NSNotification *)aNotification {
self.previousString == [NSString stringWithString:[self stringFromPasteboard]];
NSLog(@"%@", self.previousString);
[self startTimer];
}
- (void)startTimer {
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector
selector(readPasteboard
userInfo:nil repeats:YES];
}
- (void)readPasteboard
NSTimer *)theTimer {
NSLog(@"%@", self.previousString); //<- this i hawe mistake.
}
- (NSString *)stringFromPasteboard {
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
NSArray *classes = [[NSArray alloc] initWithObjects:[NSString class], nil];
NSDictionary *options = [NSDictionary dictionary];
NSArray *copiedItems = [pasteboard readObjectsForClasses:classes options
ptions];
return [copiedItems objectAtIndex:0];
}
I have some code which read buffer and write this value in variable, but on the second iteration of timer i get out of memory exception, what is mean?
Thanks.
- (void)applicationDidFinishLaunching
self.previousString == [NSString stringWithString:[self stringFromPasteboard]];
NSLog(@"%@", self.previousString);
[self startTimer];
}
- (void)startTimer {
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector
}
- (void)readPasteboard
NSLog(@"%@", self.previousString); //<- this i hawe mistake.
}
- (NSString *)stringFromPasteboard {
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
NSArray *classes = [[NSArray alloc] initWithObjects:[NSString class], nil];
NSDictionary *options = [NSDictionary dictionary];
NSArray *copiedItems = [pasteboard readObjectsForClasses:classes options
return [copiedItems objectAtIndex:0];
}