Integrate Flurry SDK for iOS

Important

All iOS Flurry SDKs are fully compliant with ATS since version 7.2.0 released September 2015. Flurry does not require any special exceptions to be added to your apps.

Integrating with the Flurry SDK is easy and straightforward for iOS developers.

Once you get your Flurry API Key (more on how to create an app ) import Flurry libraries, add the required frameworks for Flurry integration, and finally initialize Flurry and start a Flurry session.

In no time at all, you’ll be ready to start logging events and publishing your ads.

Follow these instructions for either CocoaPods Swift Package Manager, Carthage or manual integration. Swift integration steps are also provided.

Prerequisites

The minimum supported iOS version for Flurry is 10.0.

Create an App & Get Your API Keys

Start by creating an app. Once you create the app, you’ll receive a Flurry API Key, which you’ll need when using the SDK.

Important

You need to have the administrator role on your company’s account to be able to create a new app within the company.

Sign up  or  Create an App for iPhone

Note

For each distinct app that you create, you’ll need to acquire a unique Flurry API Key.

Import Flurry Libraries

Flurry recommends that you use CocoaPods to integrate the Flurry SDK, as it makes integrating and updating libraries faster, simpler and less prone to error.

If you are looking to get Flurry SDK packaged in .a files, follow the instructions for Manual SDK Integrations.

CocoaPods Integration

The CocoaPods integration steps are relevant if you are coding Swift or ObjectiveC.

Flurry distributes the iOS SDKs via CocoaPods. CocoaPods is used to install and manage dependencies in existing Xcode projects.

To install the CocoaPods tool on OS X, enter this command from Terminal:

$ sudo gem install cocoapods

To add a Flurry SDK to your iOS app using CocoaPods, follow these steps:

  1. If you are not integrating Flurry into an existing project, create an Xcode project and save it to your local machine.

  2. Navigate to your project’s directory and create a Podfile by typing $ pod init.

  3. Open the Podfile and add your dependencies under your target. To integrate only Flurry Analytics, include only the Analytics Pod. To integrate Flurry Advertising, you must include both pods.

pod 'Flurry-iOS-SDK/FlurrySDK' #Analytics Pod

Note

Remember to include use_frameworks! if your app target is in Swift.

  1. Run $ pod install in the directory containing the Podfile.

  2. Open your app’s .xcworkspace file to launch Xcode. Use this file for all development on your app.


For more information on working with CocoaPods, refer to the CocoaPods Getting Started guide

Swift Package Manager Integration

As an alternative to Cocoapods you can use Swift Package Manager to import the Flurry libraries.

Note

The Flurry Swift Package requires XCode 12 or higher and Swift 5.3 or higher

To add a Flurry SDK to your iOS app using SPM, follow these steps:

  1. On the Build Phases screen -> Choose “Link Binary With Libraries” -> Click “+” -> Choose “Add Other” -> Choose “Add Package Dependency” or Project Settings -> Package Dependencies

ios sdk swift package setup
  1. Enter the following repo in the url section: https://github.com/flurry/FlurrySwiftPackage/

ios sdk swift package repo setup
  1. Click Add Package and the following page should appear:

ios sdk swift package selection
  1. Choose the Packages needed for your project.

Note

Flurry Analytics is required to use FlurryConfig and FlurryMessaging.

  1. Flurry Analytics Swift Package requires the System Configuration framework (SystemConfiguration.framework). On the Build Phases page, under “Link Binary With Libraries”, click on “+” and add “SystemConfiguration.framework”

Carthage Integration

  1. Read the instructions to install Carthage: https://github.com/Carthage/Carthage first.

  2. Create a Cartfile in the same directory where your .xcodeproj or .xcworkspace is

  3. List the desired dependencies in the Cartfile, for example:

github “flurry/FlurryCarthage” ~> 12.0.0

  1. Run carthage update –use-xcframeworks in your project folder.

A Cartfile.resolved file and a Carthage directory will appear in the same directory where your .xcodeproj or .xcworkspace is.

  1. Drag the built .xcframework bundles from Carthage/Build into the “Frameworks and Libraries” section of your application’s Xcode project.

Note

FlurryMessaging and Config require Analytics.

  1. Add the SystemConfiguration framework to the app.

  2. If you are using Carthage for an application, select “Embed & Sign”, otherwise “Do Not Embed”.

Initialize Flurry

To finish integrating Flurry, you’ll need to import Flurry in your Application Delegate and start a Flurry session inside applicationDidFinishLaunching, as described for Objective-C and Swift.

Addtional options for FlurrySessionBuilder:

Now test run your app and ensure that it builds and runs without errors. If everything is working properly, a session will be recorded in Flurry and should be visible on your Real Time dashboard within 30 seconds.

Important

If you created the Flurry app within the last 5 minutes, the app may not yet be live on our servers and thus will not reflect real-time data. Re-run your app after 5 minutes to see your session recorded on the Real Time dashboard.

FlurryDelegate

Starting version 6.3.0, Flurry analytics can take a delegate to callback on session getting created. A new protocol, FlurryDelegate is added to Flurry Analytics. The delegate object for Flurry needs to implement protocol, FlurryDelegate and need to be set as delegate using the following API call:

[Flurry setDelegate:<object that implements FlurryDelegate>];

Once the delegate is set and the delegate responds to selector flurrySessionDidCreateWithInfo:, the delegate gets a callback on the session getting created every time. The info provided in the callback is a NSDictionary object which contains data, “apiKey” and “sessionId”.

Congratulations! Your iOS app is now ready to be used with Flurry Analytics, and if you’ve integrated the Flurry Ads library, Flurry Advertising.

Integrating Other Analytics Features

Once you’ve completed the basic SDK integration setup, you’re can move on to Custom Events, Revenue Analytics, Crash Analytics, and other Advanced Features.

Need Help?

Check out our robust collection of FAQs and a detailed Lexicon of key terminology. Didn’t find what you were looking for? Contact support@flurry.com for additional support.