Using CocoaPods

Learn how to integrate CocoaPods into your iOS Mobile app.

Use the following steps to set up Cocoa Pods in your project.

  1. Open a terminal and navigate to your project.
  2. Run the following command to initiate CocoaPods and create the default podfile for defining the project dependencies:
    pod init
    The default Podfile is created for your project.
  3. Open the Podefile in Xcode. This can be done from the command line using the following syntax:
    open -a Xcode Podfile
  4. Open the pod file for editing.
  5. Define the default iOS platform. The default platform is defined as 7.0 in the following code example:
    platform :ios, '7.0'
    Note: If the platform is not defined version 4.3 is assumed.
  6. Define your dependencies using the following syntax:
    pod 'Dependency Name' 'Dependency Version'
  7. From the terminal, run the command to install the defined dependences:
    pod install

    The Pods folder is not created to store the project dependencies and the project.xcworkspace is created.

    Important: At this point all project work must be done in the xcworkspace.
  8. Open the project .xcworkspace.

    Notice that you now have two separate projects in the workspace. Add any new files to the Xcode project and not the Pods project.

  9. Create new files from Xcode by navigating to File > New > File. Select iOS > Source > Cocoa Touch Class, and click Next. Select Cocoa Touch Template
  10. Name the class, assign it as a subclass, create the XIB file for iPhone or iPod, and click Next. Create XIB File
  11. Add the new file to the Xcode project (not the pod project) and click Create.

The project is now ready to build. Add as many pods as needed to satisfy the app dependencies and requirements. To test a complete CocoaPods Ooyala project, see Testing the Ooyala CocoaPods Tutorial.

How to Install the Ooyala SDK.framework through Cocoapods

  1. Install the latest version of Cocoapods.
    gem install cocoapods
  2. Add the Ooyala private specs repo to your local Cocoapods. For example:
    pod repo add ooyala-specs https://github.com/ooyala/ios-sdk-podspecs.git
  3. To be sure the repo is up to date, update it.
    pod repo update ooyala-specs
  4. Open or create your Podfile in your iOS project root directory, add the source for the Ooyala repo and add the OoyalaSDK pod to the target you want. For example:
    # The order of the sources is important since it will look in that order so the recommendation is to put first the private repos first (like Ooyala) and at the end the official one from CocoaPods.
    source 'https://github.com/ooyala/ios-sdk-podspecs.git'
    source 'https://github.com/CocoaPods/Specs.git'
                        
    target 'MyApp' do
    pod 'OoyalaSDK', '~> 4.31.1'
    end
  5. Install the pods.
    pod install
  6. Whenever you update the OoyalaSDK version in the Podfile, you should run a repo update again and then do either update or install.>
    pod repo update ooyala-specs
    pod install
    pod update # use either install or update
https://help.ooyala.com/sites/all/libraries/dita/en/video-platform/tasks/ios_usingcocoapods.html

Was this article helpful?