Showing posts with label UI. Show all posts
Showing posts with label UI. Show all posts

Tuesday, January 26, 2010

How to Debug Currently Used Thread in iPhone

Sometimes everything you code is correct, just doesn't work all the time. Problem might be that occasionally your UI update related code is called from non-main thread. This is how to debug which thread you're using:

#include <pthread.h>

- (void)myFunction
{
NSLog(@"Thread (%d)",
pthread_mach_thread_np(pthread_self()));
}