问题描述
我正在使用IOS 5中的xmppframework开发聊天应用程序;它完美地运作。但是我将我的xcode更新为4.5.1,将ios5更新为IOS 6,将我的mac OS更新为10.7.5,由于弃用问题,该项目无法正常工作。我用ios 6中的新方法替换了所有方法,除了这一个:
I am developing a chat application using xmppframework in IOS 5; it works perfectly. But I updated my xcode to 4.5.1, ios5 to IOS 6 and my mac OS to 10.7.5, and the project did not work due to deprecated issues. I replaces 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?
推荐答案
这取决于你需要通过这个调用实现什么。
Apple说它应该用于调试。
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.
这篇关于如何在iphone中将已弃用的方法dispatch_get_current_queue()从ios5替换为ios6?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!