-
Notifications
You must be signed in to change notification settings - Fork 369
Tutorial: Creating a cal Target
This tutorial describes how to create a -cal target. We will create a new Xcode application target by duplicating an existing production target. The -cal target is exactly like the original production application except that it will link to the calabash.framework. Linking the calabash.framework will start the Calabash iOS server when the -cal target application is launched.
Why a separate target?
The Calabash server contains symbols and methods that will cause any application that links to it to be rejected from the AppStore. A separate target with a different bundle identifier will ensure that you never accidently submit an application that has the Calabash server linked.
Some users like to have a physical and mental separation between their production and test applications.
Starting Point | Completed | Video |
---|---|---|
master | demo/cal-target | screencast.com ~7 minutes |
Right-click on the Production target and duplicate.
If you have an iPhone or iPad only app, you might see an alert like this one:
If so, be sure to select "Duplicate Only".
Be sure to check both the "Show" and "Share" options.
This step may not be necessary. You should confirm that the Executable for the -cal scheme is the -cal target.
If your production app does not already link the CFNetwork.framework, you must add it to the -cal target.
Create a Gemfile in the same directory as your .xcodeproj:
source "https://rubygems.org"
gem "calabash-cucumber", ">= 0.16", "< 2.0"
Then execute the following commands in that directory:
$ bundle
$ bundle exec calabash-ios download
----------Info----------
caution: excluded filename not matched: __MACOSX/*
caution: excluded filename not matched: calabash.framework/.DS_Store
---------------------------
Be sure to add the calabash.framework to no targets.
The linker flags are:
-ObjC -force_load "$(SOURCE_ROOT)/calabash.framework/calabash"
Be sure to select the -cal target scheme. You can target a simulator or physical device.
In your Xcode console you should see the following output - the exact content will differ by Calabash version:
DEBUG CalabashServer:222 | Creating the server: <LPHTTPServer: 0x7f80b3d066e0>
DEBUG CalabashServer:223 | Calabash iOS server version: CALABASH VERSION: 0.16.4