Why is it good to update the UI in the main thread?
Most of the classes in Uikit are not "thread-safe", in order to solve the problem of this thread is unsafe, Apple recommends that all application UI actions are executed in the main thread, so that there will be no multiple threads changing the same UI control at the same time, there is another advantage is that the main thread is high priority, This means that the UI operates at a high priority and the user experience is smoother.
Two. What is the difference between GCD and nsoperationqueue?
1.GCD supports only FIFO queues, and nsoperationqueue can adjust the order in which the queues are executed. (by adjusting weights)
2.NSOperationQueue can set dependencies between operation, and GCD cannot. If a operation relies on the data generated by another operation, you can set a operation to rely on another operation to implement, Nsoperationqueue can be based on dependencies, The operation in the queue can be executed in the correct order.
3.NSOperationQueue supports KVO. This means that you can observe the state properties of the task.
Common face questions for iOS