Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何获取当前队列名称?
我的意思是队列标签,例如com.example.myqueue.
com.example.myqueue
在 Xcode 4 调试器中,我只能看到_block_invoke_1.
_block_invoke_1
怎么样dispatch_queue_get_label?
dispatch_queue_get_label
在 Objective-C 中,您可以使用以下命令记录当前队列的标签:
NSLog(@"%s", dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL));
在斯威夫特 (2.0) 中:
print(String(UTF8String: dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL))!)