简体   繁体   中英

NSTask Until Interrupted Command in Cocoa / Objective-C

I am trying to use NSTask on to run an ASR Multicast Stream, a Ruby Server Script, etc. Basically, I'm trying to run tasks with NSTask that do not finish running until interrupted, but the problem is that I can't get the NSTask to run in the background. So it ends up just running and holding up the rest of my program. Any help?

Thanks!

NSTask shouldn't block your program unless you call the waitUntilExit method. If you have to do that, you could make a new thread and start/wait for your NSTask from inside it. As an alternative to blocking, you could look into NSTaskDidTerminateNotification . The NSTask documentation covers all of these options.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM