9

I'm working on trying to launch an automated testing solution for some iOS applications. I'm using fruitstrap to transfer and install a compiled app over to the connected iPhone, but I'm struggling to find a way to automatically launch the application after the installation is complete.

Fruitstrap has an option to run the app in the GDB debugger, which works. Unfortunately there are some test cases which will require the app to be run without the debugger attached (special crash handling). I've spent a good amount of time muddling through the resources available on MobileDevice Library which is what Fruitstrap uses, but I haven't been able to turn anything up on launching an App.

Any ideas?

2
  • Is this device jailbroken, or can you jailbreak it to solve this problem? And can you use Wifi communication, or are you limited to only USB tether communication?
    – Nate
    Jul 10, 2012 at 8:48
  • The device can not be jailbroken. Wifi is an option, but not preferred.
    – BlueVoid
    Jul 10, 2012 at 15:51

3 Answers 3

2
+50

You can do what you want by using fruitstrap or Xcode to start a "bootstrap" program that causes your target application to run via a custom URL as described by Michael.

While the bootstrap program would be running under the debugger the URL-invoked program would be running normally.

1
  • While it is a worthwhile idea, its unfortunately not an option for me. I can not modify the source of the app to be launched to include the URL handler. Also installing the bootstrap program along with the app to be tested is too much overhead.
    – BlueVoid
    Jul 17, 2012 at 18:45
2

Creating a bootstrap program and using URL Schemes may be an option for some people, and certainly should be considered, but it doesn't fit into my requirements.

What I ended up doing was to launch the app with the debugger through fruitstrap. I re-compiled fruitstrap to include the following prep commands (In the GDB_PREP_CMDS define):

handle all noprint pass nostop
continue

The handle will pass the signal on to the program so the custom signal handler (crash handler in this case) will handle the signal. The continue was something I needed so that the app would actually run once the debugger started.

There is one unfortunate flaw in this, which unfortunately I do not know a workaround for. The ARM7 version of GDB does not have the 'set dont_handle_bad_access' command like the darwin version does. For some reason passing EXC_BAD_ACCESS signals to the program does not work and the app hangs. This is significant since this is the signal for most crashes. But as it stands now, its the best I can do, and at least its handling uncaught exceptions.

1

I believe you may be looking for some sort of Custom URL Scheme.

Have a look at the following document and scroll down to: Implementing Custom URL Schemes

http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html

You can also google URL Schemes in iOS to see if you come across something similar to what you are trying to do.

Let me know if this helped you out. Would be interesting to hear if you had any success.

Cheers.

1
  • URLSchemes are a clever idea, but I'm not sure it will be a viable solution for me. I need to be able to launch the app directly from the computer which the device is tethered to, and I believe the URLSchemes only work from within other apps on the device.
    – BlueVoid
    Jul 16, 2012 at 16:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.