The Bazaarvoice Mobile SDKs provide access to most of the core products Bazaarvoice offers. To learn more, go to the Mobile SDK documentation home page.

Contents

(+ show- hide)
This guide shows you how to install and import the Bazaarvoice Mobile SDK into your iOS app.

Introduction

This guide shows you how to install and configure the Bazaarvoice Mobile SDK into your iOS app. Please make sure you have all the needed requirements for your application first! Bazaarvoice supports XCode 8.0 or higher.

If you need to use XCode 7.3, the last supported SDK version is 4.2.4.

Versioning

The Mobile SDK for iOS provides support for Objective-C and Swift programming languages. The SDK is versioned so that we can release new features, bug fixes and improvements without compromising the stability of applications using older versions.

This table summarizes the major version releases. For more information refer to the Mobile SDK for iOS (Objective-C) Github repo.

Version Release Date Status
1 Jul 16, 2012 Deprecated
2 Jan 23, 2013 Deprecated
3 Dec 21, 2015 Deprecated
4 May 4, 2016 Deprecated
5 Oct 31, 2016 Supported
6 Nov 28, 2016 Supported
7 Mar 06, 2018 Supported
8 Oct 12, 2018 Latest

This table summarizes the major version releases. For more information refer to the Mobile SDK for iOS (Swift) Github repo.

Version Release Date Status
1 Feb 28, 2020 Latest
Deprecated
These versions should not be expected to return data and/or may experience service degradation. Documentation specific to these versions may no longer be available. These versions should not be used by any applications.
Supported
Supported versions continue to receive security and bug fixes, but applications using these versions should be upgraded to the latest version when possible to take advantage of new features. New applications should not use these versions.
Latest
This is newest version. New applications should use the most recent release of this version.

Installing the BVSDK

We support installation of the Bazaarvoice SDK for iOS with CocoaPods, Carthage, Dynamic Framework, or straight up source code. Choose the solution that best fits your development environment.

By default, each BV module of the Cocoapods installs the BVCore + BVAnalytics modules.

  1. Install the latest version of CocoaPods. Bazaarvoice supports Cocoapods 1.1.0 or higher.
  2. Add the pods for which you have an API key into your Podfile:
    # each pod is a subpsec so you only need to add the lines for the component you are installing.
    pod 'BVSDK/BVAnalytics' // Automatically installed by any of the submodules below
    pod 'BVSDK/BVCommon'
    pod 'BVSDK/BVCommonUI'
    pod 'BVSDK/BVConversations'
    pod 'BVSDK/BVConversationsStores'
    pod 'BVSDK/BVConversationsUI'
    pod 'BVSDK/BVCurations'
    pod 'BVSDK/BVCurationsUI'
    pod 'BVSDK/BVNotifications'
    pod 'BVSDK/BVRecommendations'
    
  3. Run the following command from a terminal:
    $ pod install
    
  4. Open the managed .xcworkspace file to open your project in Xcode. 5. In the future, to update to the latest version of the SDK, just run:
    $ pod update
    

By default, each BV module of the Cocoapods installs the BVCore + BVAnalytics modules.

  1. Install the latest version of CocoaPods. Bazaarvoice supports Cocoapods 1.1.0 or higher.
  2. Add the pods for which you have an API key into your Podfile:
    # each pod is a subpsec so you only need to add the lines for the component you are installing.
    pod 'BVSwift/BVAnalytics' // Automatically installed by any of the submodules below
    pod 'BVSwift/BVCommon'
    pod 'BVSwift/BVConversations'
    pod 'BVSwift/BVCurations'
    pod 'BVSwift/BVRecommendations'
    
  3. Run the following command from a terminal:
    $ pod install
    
  4. Open the managed .xcworkspace file to open your project in Xcode. 5. In the future, to update to the latest version of the SDK, just run:
    $ pod update
    
  1. Install the latest version of Carthage.
  2. Add the following line to your Cartfile:
    github "bazaarvoice/bv-ios-sdk"
    
  3. Follow the Carthage installation instructions.
  4. In the future, to update to the latest version of the SDK, run the following command:
    $ carthage update
    
  1. Install the latest version of Carthage.
  2. Add the following line to your Cartfile:
    github "bazaarvoice/bv-ios-swift-sdk"
    
  3. Follow the Carthage installation instructions.
  4. In the future, to update to the latest version of the SDK, run the following command:
    $ carthage update
    
  1. Download the latest BVSDK.framework.zip from our GitHub releases page.
  2. Drag BVSDK.framework to the "Embedded Binaries" section of your Xcode project's "General" settings. Make sure to select "Copy items if needed".
  3. Head to the "Build Phases" section of your Xcode project settings, and create a new "Run Script Build Phase". Paste the following snippet into the text field:
    bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/BVSDK.framework/integrate-dynamic-framework.sh"
    
  1. Download the latest BVSwift.framework.zip from our GitHub releases page.
  2. Drag BVSwift.framework to the "Embedded Binaries" section of your Xcode project's "General" settings. Make sure to select "Copy items if needed".
  3. Head to the "Build Phases" section of your Xcode project settings, and create a new "Run Script Build Phase". Paste the following snippet into the text field:
    bash "${BUILT_PRODUCTS_DIR}/${FRAMEWORKS_FOLDER_PATH}/BVSwift.framework/integrate-dynamic-framework.sh"
    
  1. Clone this repo, or download the latest release from GitHub:
  2. Copy all the source folders under /BVSDK, except the Support folder, into your project. Make sure to select Copy items if needed.
  1. Clone this repo, or download the latest release from GitHub:
  2. Copy all the source folders under /BVSWift, except the Support folder, into your project. Make sure to select Copy items if needed.

Configuring the BVSDK

Once you have installed the source code for the SDK, you are now ready to initialize the BVSDKManager with your API key(s) and envrionment (staging versus production).

The table below will generate a configution file for your SDK. The values you set will generate the necessary script and Mobile SDK intialization code to get you up and running quickly.

Each client application should have its own API key. If you need to generate a new key for Conversations please see Conversations Requesting API Keys.

For all other API keys or if you don't know your client ID, contact Bazaarvoice Support or your implementation team.

Products Production Staging
Curations
Conversations
Conversations for Stores
Product Recommendations & Advertising
Analytics Locale

Enter your Client ID and at least one API key.

Add the correct import statements so you can reference the Mobile SDK modules you are using.

@import BVSDK;
import BVSDK
import BVSwift

Initialize the BVSDKManager in your XCode project.

After you have completed the previous steps, insert the following code in AppDelegate#applicationDidFinishLaunchingWithOptions:

Staging

              [BVSDKManager configure:BVConfigurationTypeStaging]; //Configure with Staging API keys
            

Production

              [BVSDKManager configure:BVConfigurationTypeProd]; //Configure with Prod API keys
            

Initialize the BVSDKManager in your XCode project.

After you have completed the previous steps, insert the following code in AppDelegate#applicationDidFinishLaunchingWithOptions:

Staging

              BVSDKManager.configure(.staging) //Configure with Staging API keys
            

Production

              BVSDKManager.configure(.prod) //Configure with Prod API keys
            

Initialize the BVManager in your XCode project.

Staging

              BVManager.sharedManager.getConfiguration 
            

Production

              BVManager.sharedManager.getConfiguration 
            

Programatically configuring the BVSDK

The BVSDKManager can also be configured programatically. This scenario is not typically recommended, however, you can use this method if you need to modify your API keys within the same application session.

NSDictionary *configDict = @{ 
    @" apiKeyConversations" : @" YOUR_API_KEY", 
    @"clientId" : @" YOUR_CLIENT_ID" 
}; 

[BVSDKManager
    configureWithConfiguration:configDict 
    configType:BVConfigurationTypeStaging
]; 

The BVSDKManager can also be configured programatically. This scenario is not typically recommended, however, you can use this method if you need to modify your API keys within the same application session. Configure the BVSDKManager programmatically for the Conversations API like the Swift example below. Call BVSDKManager.configure(...) when you need to update the API key and environment in use.

let configDict = ["clientId": "YOUR_CLIENT_ID",
                "apiKeyConversations": "YOUR_API_KEY"];
BVSDKManager.configure(withConfiguration: configDict, configType: .staging)

The BVManager can also be configured programatically.

Configurations set programmatically will override anything in the configuration file
let configuration: BVConfiguration = //assign desired configuration 
BVManager.sharedManager.addConfiguration(configuration) 

Next