CocoaPods Guide

The Apptentive iOS SDK is available via CocoaPods, a third-party dependency manager for developers on Apple platforms.

Getting Started

You need to create a file called “Podfile” that controls the dependencies that CocoaPods installs in your Xcode project:

  1. If you don’t already have a Podfile for your project, run pod init in your project folder.
  2. Find the latest apptentive-ios pod information on the CocoaPods site.
  3. Add the Apptentive dependency to your Podfile. It should look something like this:
platform :ios, '9.0'
use_frameworks!

target '&ltYour App Target Name&gt' do
    pod 'apptentive-ios', '~&gt 5.0'
end


If you prefer not to use the use_frameworks! directive, you will need to add the following post-install hook at the top level of your Podfile:

post_install do |pi|
    pi.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            unless pi.podfile.defined_in_file.read().include? "\nuse_frameworks!\n"
              config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
              config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'NO_USE_FRAMEWORKS=1'
            end
        end
    end
end

You will also have to add NO_USE_FRAMEWORKS=1 to the Preprocessor Macros section of your target’s build settings.

Install the Apptentive Pod

When the Apptentive dependency has been listed in your Podfile, run the Terminal command pod install in your Xcode project directory:

$ pod install

If you haven’t previously used CocoaPods for your project, this will create an Xcode Workspace containing your original project plus a project containing the Apptentive SDK (any additional CocoaPods you add in the future will be added to this second project). You will need to open this workspace (instead of your project) to make use of the CocoaPods that you have installed.

Start Using Apptentive

For information on using Apptentive in your project, please see our QuickStart Guide or our iOS Integration Reference.

Updated on September 15, 2020

Was this article helpful?

Related Articles