iossim: correct bring to front for Xcode 6

Change-Id: I7e161a20a4b24635df4f6f373966c7e52cfb593b
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
Fawzi Mohamed
2014-09-18 14:27:43 +02:00
parent 4d12c017de
commit 92f94ab4b1

View File

@@ -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 };