NSInvocationOperation and main thread
- by kpower
Imagine that I have a view with some UIKit object as its subview (for example, UIActivityIndicatorView - this doesn't matter). This view also has a selector, called doSomething, which somehow manages UIKit object (in our example it can start or stop indicator view).
I create NSInvocationOperation (from view's code parts) with initWithTarget:self selector:@selector(doSomething) object:nil. Then add it to NSOperationQueue. And all works fine.
How?! It should be a new thread and non-thread-safe UIKit object! Why no error found (and no crash happened)?