Applause SDK Installation Guide for iOS

Applause SDK Installation Guide for iOS

NOTE: Starting from 3.10.0 applications must be compiled with Xcode 8, using Swift 3; the last framework version which supports Swift 2.2 is 3.9.0

ALSO please note if you wish to use Swift 2.3 with 3.10.0 then please choose 3.10.0-swift2.3

Please check the iOS SDK migration guidelines if you are updating your SDK from an earlier version

CocoaPods Installation Guide

We strongly recommend this type of integration. To integrate Applause SDK using CocoaPods, add this line to your Podfile:

use_frameworks!
pod 'Applause-SDK', '~> 3.11.0' # for Swift 3.1
pod 'Applause-SDK', '3.10.0-swift2.3' # for Swift 2.3

You may have to update your cocoapod repo to see all versions of the Applause SDK:

pod repo update

Or, you can check the cocoapod website: https://cocoapods.org/pods/Applause-SDK

Since Applause framework uses Swift you need to use use_frameworks! flag in your Podfile.

For installing CocoaPods, check the guide at: http://cocoapods.org/

Manual Integration

Step 1 – Download the Applause Sdk

Start by downloading the latest version of the Applause iOS SDK (v3.11.0, ZIP)

If you want to go with Swift 2.3 please use Applause iOS SDK (v3.10.0-swift2.3, ZIP)

Step 2 – Add Applause to Your Project

Do this by dragging and dropping the Applause.framework folder you downloaded onto the “Frameworks” folder in your Xcode Project Navigator. The Applause framework should now be visible in Xcode just like any other framework (like the UIKit.framework, for instance).

Step 3 – Add Applause to Embedded Frameworks

In project settings (clicking on your project in the Project Navigator), select your target, and then choose “General” tab. Add Applause.framework to the “Embedded Binaries” by clicking a +.

Step 4 – Enabling Swift code

Since SDK 3.6.0 our SDK contains Swift code and so if you’re already using Xcode 8 it is necessary to enable ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES in your project. For Xcode 7 the flag you need to enable is EMBEDDED_CONTENT_CONTAINS_SWIFT (more details can be found here)

Step 5 – Set Linker Flags

Add the following flags to OTHER_LINKER_FLAGS in your project configuration for both Debug and Release modes: -ObjC

You can find this setting by clicking on your project in the Project Navigator, choosing “Build Settings”, and search for OTHER_LINKER_FLAGS.

Step 6 – Import Applause Module

Objective-C

Import Applause module using:

@import Applause;

in a file in which you want to use Applause SDK.

Swift

To use Applause SDK in Swift class, simply import it with:

import Applause

at the beginning of your Swift class file.

Starting Applause SDK

At this point your project should be properly configured to used Applause SDK. The last thing that needs to be done is to start sessions. For that you need to copy your API Key for the Application Settings.

  • QA Mode: extended device condition logging, UI for logging in and reporting problems – (it’s default mode)
  • Market Mode: headless mode, with limited logging, only crashes are reported (MARKET MODE has been deprecated and will be removed in future versions)

Check the advanced configuration settings document to learn how change mode.

Objective-C

To start sessions in Objective-C projects add the following call to your AppDelegate.m (should be at the beginning of the didFinishLaunchingWithOptions: method):

#import "AppDelegate.h"

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[APLLogger startNewSessionWithApplicationKey:@"Paste Your API Key Here"];
return YES;
}

@end

Swift

To start sessions in Swift projects add the following call to your AppDelegate.swift (should be at the beginning of the didFinishLaunchingWithOptions: method):

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
APLLogger.startNewSession(withApplicationKey: "Paste Your API Key Here")
return true
}
}

Logging

Objective-C

Replace all instances of NSLog with APLLog to send logs to the Applause server in addition of logging to console:

APLLog(@”This is test log with object %@”, object);

Swift

In Swift, use the log method on object of Applause type:

APLLogger.log("This is a default info log with object \(object)")
APLLogger.log(This is a warning log with object \(object)", with: APLLogLevelWarning)

To learn more about logging events using Applause, see the Logging Methods documentation.

Crash Reporting

Applause handles uncaught exceptions from your application and sends revelant information to the Applause server.

If you are deploying a build to the App Store, or you’ve removed the symbols from your build, you will also need to upload a special symbols file to Applause so that it can symbolicate your crashes. You can find more info at Symbolication help article.

Advanced Configuration Settings

For advanced configuration settings, please see this document.