Grand Central Dispatch, Background Processing, and App State Management
1. Grand Central Dispatch Basics
Grand Central Dispatch (GCD) is a powerful tool for handling background processing. When using __block to define a variable, it becomes directly available to all blocks within the same scope. A notable feature is that __block - qualified variables aren’t duplicated or retained inside a block.
In terms of UIKit thread - safety, messaging GUI objects from a background thread is prohibited. GCD offers a solution: we can use dispatch_async() along with dispatch_get_main_queue() to send work back to the main thread. Here is an example of the doWork: method:
超级会员免费看
订阅专栏 解锁全文
8

被折叠的 条评论
为什么被折叠?



