After stumbling a few times while setting up my development environment for the Pebble Smart-watch, I decided to write a step-by-step guide on the topic to save time and sanity to other developers coding their first application for Pebble using Xcode 5 under OS X Mavericks and iOS.
Things You’ll Will Need In Your iOS Device
- Update to iOS 7 just to be sure.
- Don’t bother downloading the Pebble app from the App Store (v1.x). You need to submit a form to receive an .ipa with the 2.x version.
- After receiving the .ipa file with the Pebble app v2.x, install it. Open your device’s Settings app, select Pebble and enable ‘Developer Mode’.
- Return to the home screen and open the Pebble app. Select ‘Developer Connection’ and enable it.
Things You Need In Your Pebble Smart-Watch
- Be sure you have opened the iOS Pebble app v2.x at least once.
- Put your Pebble in Recovery Mode: Press the Back button, the Up button and the Select button for at least 30 seconds until you see ‘Loading…’ on the screen.
Don’t let that ‘Pebble’ screen fool you! Keep pressing those buttons until you can read ‘Loading…’.
- Re-pair your Pebble with your iOS device’s bluetooth.
- If your device suggests that an upgrade is available, refuse the upgrade.
- Open one of the following links from your iOS device, your phone will start upgrading your Pebble:
If your serial number starts with a number, download Pebble Firmware 2.0-BETA2 for ev2_4..
If your serial number starts with the letter Q, download Pebble Firmware 2.0-BETA2 for v1_5.
Things You Need In Your Computer
- Install the Xcode Command Line Tools by typing the following command in the Terminal:
If you have problems installing them via this command (‘Can’t install the software because it is not currently available from the Software Update server’ error), download the installer manually from the Developer Center.
Don’t skip this step! The Command Line Tools are not installed by default in Xcode 5.
- Download the latest version of the Pebble SDK. Go and grab it from the Getting Started Guide, there is big orange button that reads ‘PEBBLE SDK’.
- Create a directory for all Pebble tools:
- Unzip the Pebble SDK inside that directory. You should end with something like:
- Add the Pebble tool to your command line:
echo 'export PATH=~/pebble-dev/PebbleSDK-2.0-BETA2/bin:$PATH' >> ~/.bash_profile
- Reload your shell configuration to make it available immediately
- Download the toolchain for OS X (arm-cs-tools-macos-universal-static.tar.gz).
- Extract that compressed file inside
~/pebble-dev/PebbleSDK-2.0-BETA2. Be sure you end with something like:
- Install the Python packet manager, pip:
sudo easy_install pip
- And all the Python dependencies used by Pebble:
pip install --user -r ~/pebble-dev/PebbleSDK-2.0-BETA2/requirements.txt
If this last step fails, it is probably because you don’t have the Xcode Command Line Tools installed.
Things You Need In Your Xcode Project
PebbleVendor.frameworkin your Xcode project.
-ObjCto Other Linker Flags of your target’s Build Settings.
- In your Info.plist file, add the value
com.getpebble.publicto the Supported external accessory protocols array.
- Also in the Info.plist file, add the value App communicates with an accessory to the Required background modes array.
- In the Build Settings of your project, change Architecture’s value from
Otherwise, you will bump with the following error:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_PBPebbleCentral", referenced from: objc-class-ref in NPViewController.o ld: symbol(s) not found for architecture x86_64
After all those steps, your watch, Mac, iPhone and Xcode should be ready to start coding.
Did somebody said ‘Hello World‘?