1つのウィンドウを持つUIAgentアプリケーションがあります。別のアプリケーションから非表示/表示したいのですが、ココアでどうすればよいですか?hide/unhideメソッドはNSRunningApplicationUIAgentプロセスに影響を与えないようです。
前もって感謝します
1つのウィンドウを持つUIAgentアプリケーションがあります。別のアプリケーションから非表示/表示したいのですが、ココアでどうすればよいですか?hide/unhideメソッドはNSRunningApplicationUIAgentプロセスに影響を与えないようです。
前もって感謝します
で解決しましたNSDistributionNotifications。UIAgentアプリケーションで、オブザーバーを@"QuitProcessNotification"(他の名前)に追加します。
[[NSDistributedNotificationCenter defaultCenter]
addObserver:self selector:@selector(quit:)
name:@"QuitProcessNotification"
object:@"com.MyCompany.MyApp"
suspensionBehavior:NSNotificationSuspensionBehaviorDeliverImmediately];
コールバックは次のようになります。
- (void) quit:(NSNotification *) notification
{
[NSApp terminate:nil];
}
メインアプリケーションの場合:通知の送信:
[[NSDistributedNotificationCenter defaultCenter]
postNotificationName:@"QuitProcessNotification"
object:@"com.MyCompany.MyApp"
userInfo: nil /* no dictionary */
deliverImmediately: YES];
objectパラメータが実際に送信者アプリケーションのバンドル識別子であることを確認してください。