Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
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.
|master||demo/cal-target||screencast.com ~7 minutes|
Step 1. Create the -cal Target
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".
1.2 Rename with -cal
1.3 Change the bundle identifier
1.4 Change the Info.plist
1.5 Delete duplicate Info.plist
Step 2: Create the -cal Scheme
2.2 Set the Scheme name
Be sure to check both the "Show" and "Share" options.
2.3 Set Scheme Executable
This step may not be necessary. You should confirm that the Executable for the -cal scheme is the -cal target.
3. Link CFNetwork.framework
If your production app does not already link the CFNetwork.framework, you must add it to the -cal target.
4. Link calabash.framework
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 ---------------------------
4.2 Add the calabash.framework
Be sure to add the calabash.framework to no targets.
4.3 Link the calabash.framework
The linker flags are:
-ObjC -force_load "$(SOURCE_ROOT)/calabash.framework/calabash"
5. Build and Run
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