Learn how to integrate CocoaPods into your iOS Mobile app.
Use the following steps to set up Cocoa Pods in your project.
- Open a terminal and navigate to your project.
Run the following command to initiate CocoaPods and create the default podfile
for defining the project dependencies:
pod initThe default Podfile is created for your project.
Open the Podefile in Xcode. This can be done from the command line using the
open -a Xcode Podfile
- Open the pod file for editing.
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.
Define your dependencies using the following syntax:
pod 'Dependency Name' 'Dependency Version'
From the terminal, run the command to install the defined dependences:
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.
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.
- Create new files from Xcode by navigating to File > New > File. Select iOS > Source > Cocoa Touch Class, and click Next.
- Name the class, assign it as a subclass, create the XIB file for iPhone or iPod, and click Next.
- 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
Install the latest version of Cocoapods.
gem install cocoapods
Add the Ooyala private specs repo to your local Cocoapods.
pod repo add ooyala-specs https://github.com/ooyala/ios-sdk-podspecs.git
To be sure the repo is up to date, update it.
pod repo update ooyala-specs
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.
# 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
Install the pods.
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