Friday, July 11, 2014

How To Have Xcode Automatically Delete an iOS Simulator Content Folder When Building Your App

Inspired by Matt ConeyBeare's post Programmatically Opening the iOS Simulator Data Directory for Your App, I've written a shell script, with Matt's script as a template, to delete an app's content folder in the iOS simulator with every build. I needed this while testing the content download startup code for an app I'm working on.

To use the script create an Xcode Run Script Build Phase for the target(s) where you want it to run and paste in the following:

Note: Yes
#!/bin/sh
is redundant, but did not want to introduce confusion about what shell.