From 92f94ab4b1cc49d2c4a1a3eb2184c65fb7793f0a Mon Sep 17 00:00:00 2001 From: Fawzi Mohamed Date: Thu, 18 Sep 2014 14:27:43 +0200 Subject: iossim: correct bring to front for Xcode 6 Change-Id: I7e161a20a4b24635df4f6f373966c7e52cfb593b Reviewed-by: Eike Ziller Reviewed-by: Fawzi Mohamed --- src/tools/3rdparty/iossim/iphonesimulator.mm | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/tools/3rdparty/iossim/iphonesimulator.mm b/src/tools/3rdparty/iossim/iphonesimulator.mm index 7845a7af46..0e75fc51a9 100644 --- a/src/tools/3rdparty/iossim/iphonesimulator.mm +++ b/src/tools/3rdparty/iossim/iphonesimulator.mm @@ -261,16 +261,25 @@ static void ChildSignal(int /*arg*/) { } - (void)session:(DTiPhoneSimulatorSession *)session didStart:(BOOL)started withError:(NSError *)error { + if (started) { + // bring to front... + [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript" + arguments:[NSArray arrayWithObjects: + @"-e", @"tell application \"System Events\"", + @"-e", @" set listOfProcesses to (name of every process where background only is false)", + @"-e", @"end tell", + @"-e", @"repeat with processName in listOfProcesses", + @"-e", @" if processName starts with \"iOS Simulator\" or processName starts with \"iPhone Simulator\" then", + @"-e", @" tell application processName to activate", + @"-e", @" end if", + @"-e", @"end repeat", nil]]; + } if (startOnly && session) { - [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript" - arguments:[NSArray arrayWithObjects:@"-e", @"tell application \"iPhone Simulator\" to activate", nil]]; msgprintf(@"Simulator started (no session)"); [self doExit:EXIT_SUCCESS]; return; } if (started) { - [NSTask launchedTaskWithLaunchPath:@"/usr/bin/osascript" - arguments:[NSArray arrayWithObjects:@"-e", @"tell application \"iPhone Simulator\" to activate", nil]]; int pid = [session simulatedApplicationPID]; if (shouldStartDebugger) { char*args[4] = { NULL, NULL, (char*)[[[NSNumber numberWithInt:pid] description] UTF8String], NULL }; -- cgit v1.2.3