Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode Thread 1 : Is it always main UI thread?

Xcode shows threads in Debug navigator.

They are numbered: Thread 1, Thread 2, etc

I notice that I am always in Thread 1. Is it correct assumption that it is main UI thread? I use libs/SDK like Facebook and AFNetworking they have callbacks and delegates. But thread safety is not always properly documented.

like image 479
Tema Avatar asked Mar 12 '13 23:03

Tema


1 Answers

I don't recall which, but in one of the WWDC videos (from 2011, I think), I heard an engineer mention that the UIKit internals assume thread 1 is UI.

So yes, it's not "simply" best practice, I think there are concrete technical dependencies.

As far as specific documentation, I don't readily find an "official" statement; but I think it's because it's even more foundational than that. For example, this kind of casual mention of the main thread's role is all over the place (taken from the iOS App Programming Guide (e.g. iOS 101)

The main thread is where your app handles touch events and other user input.

like image 114
Chris Trahey Avatar answered Oct 02 '22 19:10

Chris Trahey