Objective c 目标C-将外部运行的应用程序从最小化恢复到正常

Objective c 目标C-将外部运行的应用程序从最小化恢复到正常,objective-c,macos,restore,minimize,Objective C,Macos,Restore,Minimize,我有这样的代码: - (void)sendAnswerXlite:(NSDictionary*)softPhone { __block NSString * identifier = [softPhone objectForKey:kSoftPhoneAppIdentifier]; NSAssert(identifier != nil, @"Nil identifier argument in answer input"); dispatch_async(dispatch_get_menu_ho

我有这样的代码:

- (void)sendAnswerXlite:(NSDictionary*)softPhone
{
__block NSString * identifier = [softPhone objectForKey:kSoftPhoneAppIdentifier];
NSAssert(identifier != nil, @"Nil identifier argument in answer input");
dispatch_async(dispatch_get_menu_hotkey_queue(), ^{
    // check if app is running
    NSArray * apps = [NSRunningApplication runningApplicationsWithBundleIdentifier:identifier];

    if (apps != nil && [apps count] > 0)
    {
        NSRunningApplication * frontmostApp = [[NSWorkspace sharedWorkspace] frontmostApplication];
        NSRunningApplication * runningApp = [apps objectAtIndex:0];
        if ( !([runningApp isEqualTo:frontmostApp]) )
        {
            [runningApp activateWithOptions:NSApplicationActivateAllWindows];
            //[runningApp activateIgnoringOtherApps:YES];
            [NSThread sleepForTimeInterval:1];
        }
    }
}

但即使我使用ActivateWithoOptions或ActivateIgnoring其他应用程序,它也只会将焦点设置为外部应用程序,但如果应用程序已最小化,则它将不会显示窗口X-Lite,但菜单栏将显示(在本例中)X-Lite。标识符只是应用程序的捆绑包标识符。

我也遇到了同样的问题,您能找到解决方案吗?