OGeek|极客世界-中国程序员成长平台

标题: iOS 如何获取后台调度队列完成状态 [打印本页]

作者: 菜鸟教程小白    时间: 2022-12-11 17:13
标题: iOS 如何获取后台调度队列完成状态

我已经创建了一个这样的队列

dispatch_queue_t myBackgroundQueue;
  myBackgroundQueue = dispatch_queue_create("com.google.task", NULL);


  dispatch_async(myBackgroundQueue, ^(void) {
  });

这将在按钮单击时调用,我想知道当前的后台运行队列。谢谢



Best Answer-推荐答案


    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    BOOL ok = // some result

    // do some long running processing here

    // Check that there was not a nil handler passed.
    if( completionHandler )
    {
        // This assumes ARC. If no ARC, copy and autorelease the Block.
        [completionHandler performSelectorselector(rmaddy_callBlockWithBOOL
                                  onThreadrigThread
                                withObject(ok)    // or [NSNumber numberWithBoolk]
                             waitUntilDone:NO];
    }
    });
});

关于iOS 如何获取后台调度队列完成状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38848550/






欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://ogeek.cn/) Powered by Discuz! X3.4