Reputation: 4980
I know that Xcode requires the simulator to launch while running a unit test. During my CI builds, I run unit tests. Sometimes the simulator hangs up the tests, and the tests complete once I dismiss the simulator.
Is there a way to test: 1. If we are in "test mode" in the app delegate 2. If we can programatically dismiss the simulator, either as soon as it appears or after x amount of time.
I wrote an AppleScript that will quit the simulator... I suppose I could launch it from Xcode. Does anyone know how to launch a script in a method?
Upvotes: 0
Views: 227
Reputation: 1816
iOS simulator is a mac app and cannot be dismissed from an iOS app.
either you do it with apple script or you can use a command in your build script to do that.
sudo killall "iOS Simulator"
edit: to clarify further, the script cannot be run from iOS app either. you have to call it from your build script.
Upvotes: 1
Reputation: 23623
Please file a bug report at http://bugreport.apple.com with information about what is causing the failure you are trying to workaround. Please take a sysdiagnose at the time and include ~/Library/Logs/CoreSimulator/*.log
As for programmatically running an AppleScript, you can do:
NSString *scriptSource = @"tell application ..."
NSAppleScript *script = [[[NSAppleScript alloc] initWithSource:scriptSource] autorelease];
NSError *error = nil;
[script executeAndReturnError:&error];
But you cannot use this from an app running within the iOS Simulator because it is isolated from the host.
Upvotes: 1