Titanium Tips

How to Clean the Build Folder

How to clean the iphone build folder
Cleaning the build folder is an important task that Appcelerator developers should know all about. Luckily it’s fairly straightforward.

The build folder is a directory that is created when you test your app on the iOS Simulator. The build folder includes an Xcode project and all the Objective-C code that is required for your app to run on an iOS device.

Each time you test your app in the iOS Simulator, the build folder should be updated with your latest code and everything should be hunky-dory. But this isn’t always the case.

Sometimes if you switch to a different version of Titanium or try to test your app on a real device, the build folder can get a bit confused, your app might not get updated properly, etc.

So what do you do?

If you’re using Titanium Studio, the process is simple...


1. Simply go to the Project menu and select the Clean... option.

Clean... menu option in Titanium Studio


2. Choose to clean all apps at once, or else tick the individual apps you wish to clean.
Then click OK.

Build folder cleaning options


3. Launch your app in either the iPad Simulator or iPhone Simulator.

Launch app in an iOS Simulator


A message will display in the console, saying...
[INFO] Performing full rebuild. This will take a little bit. Hold tight...

followed by...
[INFO] Performing clean build

This may take a few more seconds than testing an app normally, but it can save a whole lot of trouble.

This procedure is recommended before testing your app on a device, after switching to a new Titanium SDK version and before submitting your app to the App Store.



If you’re using Titanium Developer, or just want to know exactly what happens when using Titanium Studio’s Clean... command...


1. Navigate to [YOUR APP NAME]/build/iphone/.
Note: the folder is called iphone even if you are making an iPad or Universal app. This is just something that has carried over from the days when there was no such thing as an iPad.


Locating the iphone build folder contents

2. Move all the files within the iphone folder to the Trash.
Note: Do not delete the iphone folder itself. Titanium Developer and Titanium Studio do not like it if you do that. But don’t worry if you accidentally delete the iphone folder, just create a new blank folder called iphone within the build folder and everything should be fine.

Moving build folder contents to the Trash


3. Launch your app in the iOS Simulator again, through Titanium Studio or Titanium Developer.
A message will display in the console, saying...
[INFO] Performing full rebuild. This will take a little bit. Hold tight...

followed by...
[INFO] Performing clean build

This may take a few more seconds than testing app normally, but it can save a whole lot of trouble.

This procedure is recommended before testing your app on a device, after switching to a new Titanium SDK version and before submitting your app to the App Store.