I've got an NSLog invocation in a method that I know is getting called (I've set a breakpoint). But there's not output in that method, or at all after that method. When the app starts up, my NSLog statements are working fine. I'm wondering if this is some sort of threading issue.
NSLog stops in the taskDidTerminate method, which is a callback from an NSTask:
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(taskDidTerminate:)
name:NSTaskDidTerminateNotification
object:localTask];
Any ideas?
Edit: taskDidTerminate
- (void) taskDidTerminate: (NSNotification *) notification
{
NSLog(@"TaskDid Terminate");
[task.delegate taskCompleted:task];
}
As it turns out, it doesn't look like XCode likes it when you execute a task using /bin/bash -c (task) (commands). I've now changed it to directly execute the task, and now my NSLog() statements are working.
See here for a reference.
Adding [task setStandardInput:[NSPipe pipe]];
may bring your logs back as stated on CocoaDev: NSTask.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With