如何替换不赞成使用的方法dispatch_get_current_queue()? [英] How can I replace deprecated method dispatch_get_current_queue()?
问题描述
我正在iOS 5中使用xmppframework开发聊天应用程序;效果很好.
I am developing a chat application using xmppframework in iOS 5; it works perfectly.
但是我将Xcode更新为4.5.1,将iOS 5更新为iOS 6,将Mac OS更新为10.7.5,由于弃用问题,该项目无法正常工作.我将iOS 6中的所有方法替换为新方法,除了以下一种方法:
But I updated my Xcode to 4.5.1, iOS 5 to iOS 6 and my Mac OS to 10.7.5, and the project did not work due to deprecation issues. I replaced all methods with new methods in iOS 6 except this one:
dispatch_get_current_queue()
如何在iOS 6中替换此方法?
How can I replace this method in iOS 6?
推荐答案
这取决于您需要通过此调用实现的内容.
苹果公司指出,无论如何都应将其用于调试.
It depends what you need to achieve with this call.
Apple states that it should be used for debugging anyway.
也许队列无关紧要(因为您只需要一个后台队列),所以获取具有特定优先级(dispatch_get_global_queue(dispatch_queue_priority_t priority,
unsigned long flags);
)的全局队列
Perhaps the queue does not matter (as you just need a background queue) so get a global queue with specific priority (dispatch_get_global_queue(dispatch_queue_priority_t priority,
unsigned long flags);
)
OR,
如果您确实需要在同一队列中执行一些代码,请创建一个队列,将其保留并在其中分派所有任务.
If you do need to execute some pieces of code in the same queue , create a queue, retain it and dispatch all your tasks there.
这篇关于如何替换不赞成使用的方法dispatch_get_current_queue()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!