What is the proper way to detect if code is running on the main thread in Objective-C? (iOS) [duplicate] What is the proper way to detect if code is running on the main thread in Objective-C? (iOS) [duplicate] multithreading multithreading

What is the proper way to detect if code is running on the main thread in Objective-C? (iOS) [duplicate]


[NSThread isMainThread] and, if not, dispatch via any of a number of mechanisms to the main thread (what you have is fine).