class AsyncOperation : NSOperation {
override func main () {
print("In the user queue")
NSOperationQueue.mainQueue().addOperationWithBlock({
print("main block")
})
}
}
let queue = NSOperationQueue()
let operation = AsyncOperation();
queue.addOperation(operation)
它打印In the user queue
但不打印main block
。由于我要添加到主队列,我希望它能够被执行。我是否必须开始执行队列?