I need to automate the build/deploy process for my iphone applications from a script. I can use xcodebuild to build the project, then use Applescript to deploy and debug/run the application. Assuming the application will stop by itself after a while, I need to collect the generated logs for verification. But the problem is I have no way to know when the application ended from outside of the application itself. If the running time is fixed, I can again use Applescript to stop the application (Cmd+Shift+Enter). So there has to be a way to connect to the device/simulator and wait on the application somehow.
A:
check
- (void)applicationWillTerminate:(UIApplication *)application
delegate method of UIApplicationDelegate
Morion
2009-12-30 11:09:28
This will work if I need to handle something before exiting from the application, yes. But I need to launch the application from an external script, wait for it to stop and then do some post processing. All of this will be done outside the application.
Plumenator
2009-12-30 11:38:39
A:
I found that it is not possible to connect to the device or simulator through any other means than Xcode. Unless you jailbreak the device, of course.
I solved the problem with the simulator by just polling for the process name in the output of the unix command 'ps'. There will be a process with the name of your application. As for the device, I don't think it is possible.
Plumenator
2010-04-21 08:48:42