Blog

Using Backendless CocoaPod with XCode

by on May 28, 2014

CocoaPods manages library dependencies for your Xcode projects.

The dependencies for your projects are specified in a single text file called “Podfile”. CocoaPods resolves dependencies between libraries, fetches necessary code and links it together in an Xcode workspace to build your project.

Make sure you have the Cocoapods ruby gem installed your system. If you don’t, follow the directions from the CocoaPods Getting Started guide, or just launch a Terminal window and run:

$ sudo gem install cocoapods

Creating a new Xcode project with CocoaPods

Before you begin, check the Backendless-ios-SDK folder of CocoaPods Specs repository and choose the version of the library you will use (the latest is recommended unless you have a reason not to use it).

To create a new project with CocoaPods, follow these simple steps:

  1. Create a new project in Xcode as you normally would, then close this project.
  2. Open a Terminal window, and $ cd into your project directory.
  3. Create Podfile. This can be done by running
    $ touch Podfile
  4. Open your Podfile using your favorite text editor (or Xcode), and add the following text:
    platform :ios, '7.0'
    pod 'Backendless-ios-SDK', '~>1.15.0'

    The first line specifies the platform and version supported, the second line specifies the name of the Backendless folder in the CocoaPods Specs repository and the library version you chose.

  5. Save Podfile, return to the Terminal window and run:
    $ pod install

    Once all of the pod data is downloaded, Xcode project workspace file will be created. This should be the file you use to create your app.

  6. Open .xcworkspace file to launch your project, and build it.

Enjoy!

Leave a Reply