dispatch_queue_t callerQueue = dispatch_get_current_queue();
dispatch_retain(callerQueue);
dispatch_queue_t downloadQueue = dispatch_queue_create("Download Queue",NULL);
dispatch_async(downloadQueue,
^{
//some code that accesses a web service
dispatch_async(callerQueue,
^{
//some code that accesses UI
});
});
dispatch_release(downloadQueue);
NSLog(@"great successing!");
問題是,「大獲成功!」從來沒有出現過,並且在代碼最外面的塊的末尾沒有發生任何事情。我不確定我做錯了什麼,但我知道這有些嚴重錯誤。dispatch_async自定義隊列永遠不會退出塊
試過了你的代碼,它正在工作:http://pastie.org/2944762 –
確實如此是......所以它必須與提前發佈的下載隊列有關,我想下載需要一段時間。 –