许多长时间运行的异步方法都有完成处理程序块作为输入参数附加到它们
如果操作被取消,我不确定是否应该调用完成处理程序。
-(void)longRunningAsyncOperation:(Input *)input completionHandler:(Block)completionHandler
{
// long running code
// periodic checks for cancelation
if(_canceled)
{
// should completion handler still be called?
return;
}
// more long running code
// completed
completionHandler(someData);
}