I saw a class (inherits from NSOperation
class) with .h and .m files as usual, but in the implementation section there is -(void) main
method and NSAutoReleasePool
object, it looks like the main method of the application itself, why there should be a method with this name in a .m file ?
It is just a method on NSOperation
. The difference is:
int main (int argc, const char * argv[])
Is a C function which is where the program starts
- (void)main;
Is an objective-C instance method on a class.
The reason it has it's own auto releasepool is that it is generally called on a separate thread therefore this new thread needs to deal with auto released objects.
Maybe it's a NSThread or NSOperation subclass? They have their own main() methods.
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