• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Problem getting notifications from standard error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Problem getting notifications from standard error
      • From: Markus Hitter <email@hidden>
  • Prev by Date: Re: setting NSSlider floatvalue from different thread
  • Next by Date: Re: nsarraycontroller, bindings and big databases
  • Previous by thread: Re: Authorization Plug-in with GUI
  • Next by thread: Re: Problem getting notifications from standard error
  • Index(es):
    • Date
    • Thread