Building an Objective-C or Swift Project
What This Guide Covers
Objective-C/Swift builds are not available on the Linux environments.
Supported Xcode versions
Travis CI uses OS X 10.11.6 (and Xcode 7.3.1) by default. You can use another
version of Xcode (and OS X) by specifying the corresponding
osx_image key from
the following table:
|osx_image value||Xcode version||OS X version|
||Xcode 9.0||OS X 10.12|
||Xcode 8.3||OS X 10.12|
||Xcode 8.2||OS X 10.12|
||Xcode 8.1||OS X 10.12|
||Xcode 8||OS X 10.11|
||Xcode 7.3.1||OS X 10.11|
||Xcode 6.4||OS X 10.10|
Detailed iOS SDK versions are available in the OS X CI environment reference
At this time we are unable to provide pre-release versions of Xcode due to the NDA imposed on them. We do test them internally, and our goal is to make new versions available the same day they come out. If you have any further questions about Xcode pre-release availability, send us an email at firstname.lastname@example.org.
Default Test Script
Travis CI runs xctool by default to execute your tests. In order for xctool to work, you need to tell it where to find your project or workspace and what scheme you would like to build. For example:
language: objective-c xcode_project: MyNewProject.xcodeproj # path to your xcodeproj folder xcode_scheme: MyNewProjectTests
You can also specify an SDK using the
xcode_sdk variable. This needs to be on
X.Y is the version you want to test
If you are using a workspace instead of a project, use the
key in your .travis.yml instead of
In order to your run tests on Travis CI, you also need to create a Shared Scheme for your application target, and ensure that all dependencies (such as CocoaPods) are added explicitly to the Scheme. To do so:
- Open up the Manage Schemes sheet by selecting the Product → Schemes → Manage Schemes… menu option.
- Locate the target you want to use for testing in the list. Ensure that the Shared checkbox in the far right hand column of the sheet is checked.
If your target include cross-project dependencies such as CocoaPods, then you will need to ensure that they have been configured as explicit dependencies. To do so:
- Highlight your application target and hit the Edit… button to open the Scheme editing sheet.
- Click the Build tab in the left-hand panel of the Scheme editor.
- Click the + button and add each dependency to the project. CocoaPods will appear as a static library named Pods.
- Drag the dependency above your test target so it is built first.
You will now have a new file in the xcshareddata/xcschemes directory underneath your Xcode project. This is the shared Scheme that you just configured. Check this file into your repository and xctool will be able to find and execute your tests.
Travis CI uses CocoaPods to install your project’s dependencies.
The default command run by Travis CI is:
Note that this is only run when we detect a Podfile in the project’s root
directory. If the Podfile is in a different directory, you can use the
setting in the .travis.yml:
pod install is not run if the Pods directory is vendored and there have
been no changes to the Podfile.lock file.
If there is a
Gemfile in your project’s root directory, the
pod command is
not executed, but instead Bundler is used as a wrapper to
pod as follows:
bundle exec pod install
If you want to use a different means of handling your project’s dependencies,
you can override the
install: make get-deps
For Objective-C projects,
xcode_scheme can be given as arrays to construct a build matrix.
A complete list of simulators available in each version of Xcode is shown on the OS X environment page.