[英]GCD obtaining queue name/label
如何獲取當前隊列名稱?
我的意思是像com.example.myqueue
這樣的隊列標簽。
在 Xcode 4 調試器中,我只能看到_block_invoke_1
。
在 Objective-C 中,您可以使用以下命令記錄當前隊列的標簽:
NSLog(@"%s", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL));
在 Swift (2.0) 中:
print(String(UTF8String: dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL))!)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.