NSInvocationOperation and main thread

Posted by kpower on Stack Overflow See other posts from Stack Overflow or by kpower
Published on 2010-05-17T04:44:04Z Indexed on 2010/05/17 4:50 UTC
Read the original article Hit count: 339

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)?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c