パッケージファイルを起動して、インストールが終了/終了するのを待ちたいです。その間、メインの呼び出し元アプリケーションは終了するまでロックする必要があります。
これまで私は以下を試しました...
- (IBAction)installDriver:(id)sender
{
NSString *file = [[NSBundle mainBundle] pathForResource:@"ExamplePackage" ofType:@"pkg"];
[[NSWorkspace sharedWorkspace] openFile:file];
[[[NSWorkspace sharedWorkspace] notificationCenter] addObserver:self selector:@selector(appDidEnd:) name:NSWorkspaceDidTerminateApplicationNotification object:nil];
}
- (void)appDidEnd:(NSNotification *)notification
{
NSLog(@"app info: %@", [notification userInfo]);
}
問題は、アプリが閉じるたびにappDidEndが呼び出されることです。さらに、userinfoがinstaller.appを閉じるアプリとして報告するため、ExamplePackage.pkgが閉じられたものであるかどうかを検出できません。
私が達成しようとしていることのために何をしようとしているのかについてのアイデア....