Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
等待调度队列完成-计时-iPhone_Iphone_Objective C_Xcode_Multithreading_Grand Central Dispatch - Fatal编程技术网

等待调度队列完成-计时-iPhone

等待调度队列完成-计时-iPhone,iphone,objective-c,xcode,multithreading,grand-central-dispatch,Iphone,Objective C,Xcode,Multithreading,Grand Central Dispatch,假设我有一个应用程序使用以下方法structure: [self method1]; [self method2]; 方法1包含一个调度队列,例如: [exportSession exportAsynchronouslyWithCompletionHandler:^{ switch (exportSession.status) { case AVAssetExportSessionStatusFailed:{ NSLog (@"FAIL");

假设我有一个应用程序使用以下方法structure:

[self method1];
[self method2];
方法1包含一个调度队列,例如:

[exportSession exportAsynchronouslyWithCompletionHandler:^{
    switch (exportSession.status) {
        case AVAssetExportSessionStatusFailed:{
            NSLog (@"FAIL");
            break;
        }
        case AVAssetExportSessionStatusCompleted: {
            NSLog (@"SUCCESS");
}
};
 }];

我只想在method1中的调度队列完成后继续执行[method2]。实现这一点的最佳方法是什么?

将对
-method2
的调用放在完成处理程序块内。

只要method2不在主线程上发生就好了。如果发生了,只需将其分派到完成块内的主队列即可。