Add the SDK through CocoaPods¶
We use CocoaPods in order to make installing and updating our SDK super easy. CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.
If you don’t have CocoaPods installed on your machine you can install it by issuing the following command in your terminal:
sudo gem install cocoapods
After that you need to go to the project’s directory and initialize CocoaPods
cd /path_to/my_project/ pod init
This will also create a special file called a Podfile, where you can specify what dependencies to add to your new project. Usually it will look similar to this:
target 'MyProject' do # add dependencies end
For more information on Podfile options, please check the Podfile specification.
You can add the SDK to your project by declaring the following Pod:
target 'MyProject' do pod 'SuperAwesome', '7.0.1' end
This will tell CocoaPods to fetch the latest version of the iOS Publisher SDK. This will contain everything you need in order to load and display banner, interstitial and video ads.
After the pod source has been added, update your project’s dependencies by running the following command in the terminal:
Don’t forget to use the .xcworkspace file to open your project in Xcode, instead of the .xcproj file, from here on out.
You can import the main SDK header file like so: