Problem getting notifications from standard error
Problem getting notifications from standard error
- Subject: Problem getting notifications from standard error
- From: Rick Hoge <email@hidden>
- Date: Wed, 15 Feb 2006 07:34:32 -0500
I want to redirect (or copy) the NSLog output from my application to
an NSTextView that can be displayed from within the app. I've found
a couple of threads on this, but they all end just short of the answer.
From one such discussion, I've tried the following, which I put in
the NSApplication delegate:
-(void)getData:(NSNotification*)notification {
NSLog(@"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
}
-(void)applicationWillFinishLaunching:(NSNotification*)aNotification {
NSFileHandle *fh = [NSFileHandle fileHandleWithStandardError];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(getData:)
name:@"NSFileHandleReadCompletionNotification"
object:fh];
[fh readInBackgroundAndNotify];
}
I'd expect the getData: method to be called whenever stderr gets
written to, but it never seems to be invoked.
If anyone has an idea of what the problem or solution is, I'd be very
grateful.
Thanks,
Rick Hoge
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden