iOS8 is finally with us, and with it, an updated XCode and two new iPhones with new screen sizes.
This is awesome (obviously) but if like me, you’re in the middle of projects that aren’t iPhone 6 / iOS8 ready then you need to be able to do builds for both the iOS7 and iOS8 SDK – preferably without having to run multiple development environments.
Luckily, it is possible to do this.
(at this point I should point out that while you can do this – it’s just a workaround and you should be looking to migrate to the latest SDK as soon as possible)
So here’s my setup which currently allows me to build Titanium 3.2.x, 3.3.x and 3.4.x projects on both iOS7 and iOS8 SDKs:
- Xcode 6 is installed to my Apps folder as “Xcode”
- Xcode 5 is installed to my Apps folder as “Xcode5”
- Titanium / Appcelerator Studio 3.4 RC
- Titanium CLI 3.4 RC
- Titanium SDK 3.4 RC
- Alloy 1.5 RC
(Full instructions to install the latest versions of Titanium are available here )
Next, my setup within Titanium itself is to have the selected Xcode as my default, which is Xcode6 – so make sure in Titanium Studio > Preferences > Studio > Platforms > iOS that you have selected path/to/Xcode as the default SDK.
Once done, your simulator list should show entries like iPhone 6, iPhone 6 Plus etc.
The most important part of making all this work is to do with the Titanium CLI. Titanium Studio uses the CLI, Studio and the current SDK selections to work together to make certain build options available.
So, ensure that once you have installed the Titanium 3.4 CLI and Titanium 3.4 SDK, you have configured the CLI to use the latest SDK. To do this go to the terminal and type:-
$ ti sdk select
and you should get a list of installed SDKs and you want the 3.4 version to be “selected” if not, input it’s number e.g “1”.
Once all the components are in sync we’re ready to test.
You should now be able to load a project into Studio, and alter it’s TiApp.xml file, to edit the SDK. As you do this, and save the settings, going to the build options will show different simulators.
So, if you select for example 3.2 as the SDK, then when you save and try to build to a device, you’ll see the normal list of Simulators (e.g. iPhone 3.5 inch, iPhone 4 inch etc).
If you change the project to use the 3.4 SDK and save it, then try to build again, you’ll see a list like “iPhone 4, iPhone 5, iPhone 6” etc.
If you’re not seeing this, check the SDK selected by the CLI, as it could be you’ve changed it to use 3.2 or 3.3. It must be on the latest version (3.4).
So with this setup, it’s possible to select pre 3.4 and build to the iOS7 SDK, which will support iOS6 + 7 devices, OR update to 3.4 and build with the iOS8 SDK.
Remember, updating and building to the iOS8 SDK means your app will resize for the new iPhones – so if you haven’t tested this, or prepared your app to be scalable like this, things are going to get funky!
PS, there’s a great Q&A on all the new tools over here