0

This may sound like noobish question but I have tried researching these two classes and I am not 100% sure what their differences and specific purposes are. Also, is there some way I can retrieve a list of all the currently running processes much like Task Manager on windows? I was thinking some static function would be able to return an array of NSThreads or NSTasks... or I may just be going about this completely wrong xD

Thanks in advance for any help! Thom

rolling_codes
  • 15,174
  • 22
  • 76
  • 112
  • Yes, it [is possible to get information about other running apps on the iPhone](http://stackoverflow.com/questions/8275578/how-to-get-information-about-free-memory-and-running-processes-in-an-app-store-a) (if you are thinking of something like the Task Manager). For other running tasks or threads within your *own* app? You'd probably have to figure out a way to keep track of that. – Michael Dautermann Aug 09 '12 at 13:39
  • Thanks for the info. Are you experienced at all with retrieving information from other running apps? – rolling_codes Aug 09 '12 at 13:41
  • on the iPhone? Myself? No. Apple's sandbox policy makes it impossible (or pretty darn close to impossible) to do *anything* with that information, aside from being able to display it. What are you really trying to do? – Michael Dautermann Aug 09 '12 at 13:44
  • well thats what i am trying to do. i just want to see all of the processes running on my iphone currently, not just the apps that are running in the background. i have two apps that i want to have communicate by detecting when the other one starts a certain subprocess or progr – rolling_codes Aug 09 '12 at 13:47

2 Answers2

1

NSThread is provided to create and manage background threads. You don't hear much about it today because libraries like Grand Central Dispatch GCD and NSOperationQueue have been added by Apple recently for those purposes and offer ease of use.

NSTask is kind of like a wrapper for the C system command. It is only available on Mac OSX environments (not IOS) and is used to launch operating system commands - commands typically used from the command line. For example, awhile back, I took some handy bash utilities that I had developed for managing Xerox printers and put a Cocoa front end on them by using Cocoa for the graphical interface and using NSTask to launch the command lines. NSTask can be mapped to the input and output of those unix commands, so you can send them stuff on stdin and get stuff back on sdout

hope that helps to clear it up

CocoaEv
  • 2,984
  • 20
  • 21
0

Well i answered part of my own question for obtaining a list of processes thanks to this website: http://jongampark.wordpress.com/2008/01/26/a-simple-objectie-c-class-for-checking-if-a-specific-process-is-running/

I still dont know what an NSTask and NsThread are used for though O.o

rolling_codes
  • 15,174
  • 22
  • 76
  • 112