¿Hay alguna forma de verificar si el hilo actual es o no el hilo principal en Objective-C?
Quiero hacer algo como esto.
- (void)someMethod
{
if (IS_THIS_MAIN_THREAD?) {
NSLog(@"ok. this is main thread.");
} else {
NSLog(@"don't call this method from other thread!");
}
}
fuente
