Integrate Flurry SDK for iOS¶
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.
Flurry’s minimum supported iOS version 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.
You need to have the administrator role on your company’s account to be able to create a new app within the company.
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.
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:
If you are not integrating Flurry into an existing project, create an Xcode project and save it to your local machine.
Navigate to your project’s directory and create a Podfile by typing
$ pod init.
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
Remember to include
use_frameworks! if your app target is in Swift.
$ pod installin the directory containing the Podfile.
Open your app’s
.xcworkspacefile 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.
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:
On the Build Phases screen -> Choose “Link Binary With Libraries” -> Click “+” -> Choose “Add Other” -> Choose “Add Package Dependency” or Project Settings -> Package Dependencies
Enter the following repo in the url section: https://github.com/flurry/FlurrySwiftPackage/
Click Add Package and the following page should appear:
Choose the Packages needed for your project.
Flurry Analytics is required to use FlurryConfig and FlurryMessaging.
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”
Read the instructions to install Carthage: https://github.com/Carthage/Carthage first.
Create a Cartfile in the same directory where your .xcodeproj or .xcworkspace is
List the desired dependencies in the Cartfile, for example:
github “flurry/FlurryCarthage” ~> 12.0.0
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.
Drag the built .xcframework bundles from Carthage/Build into the “Frameworks and Libraries” section of your application’s Xcode project.
FlurryMessaging and Config require Analytics.
Add the SystemConfiguration framework to the app.
If you are using Carthage for an application, select “Embed & Sign”, otherwise “Do Not Embed”.
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.
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.
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.
Check out our robust collection of FAQs and a detailed Lexicon of key terminology. Didn’t find what you were looking for? Contact firstname.lastname@example.org for additional support.