Blocks the process until the receiver is finished.
Availability
有効性
macOS 10.0+
Mac Catalyst 15.0+
Technology
Foundation
ファウンデーション
Declaration
宣言
- (void)waitUntilExit;
Discussion
議論
This method first checks to see if the receiver is still running using running. Then it polls the current run loop using NSDefaultRunLoopMode until the task completes.
このメソッドは、最初にレシーバがまだ実行中かどうか知るためにrunningを使って確認します。それからそれは現在の実行ループにNSDefaultRunLoopModeを使ってポーリングします、そのタスクが完了するまで。
NSTask *task = // Create and initialize a task[task launch];[task waitUntilExit];int status = [task terminationStatus];if (status == 0) {NSLog(@"Task succeeded.");} else {NSLog(@"Task failed.");}
waitUntilExit does not guarantee that the terminationHandler block has been fully executed before waitUntilExit returns.waitUntilExitは、terminationHandlerブロックが完全に遂行されることを保証しません、waitUntilExitが返る前には。