Mobile SDK Sizes

iOS SDK Framework

The pre-compiled iOS Framework is approx. 100 Mb

Why is it so big?

  • the pre-compiled framework has to support several iOS architectures (arm7, arm7s, arm64)

Once compiled into an .ipa the sdk is ~3MB

Android SDK Library

Once included in the apk the additional size <1 MB and adds ~5K methods.

 

More details here:

HelloWorld application w/o the Applause SDK

HelloWorld application with the Applause SDK

 

 

 

iOS SDK Migration Guidelines

Migration from 3.10.1 to 3.11.0

If you were using Logger.swift you need to revert back to Objective-C class APLLogger available in Swift projects. Please refer to docs to checkout example usages of APLLogger in Swift.

Migration from 3.10.0 to 3.10.1

No migration needed.

Migration from 3.9.0 to 3.10.0 (3.10.0-swift2.3)

In order to compile project you need to update to Xcode 8 – Applause framework is compiled using iOS SDK 10 (Xcode 8) using Swift 3.

If you plan to not migrate to Swift 3 and instead update to Swift 2.3 using Xcode 8, please use 3.10.0-swift2.3 of the Applause iOS SDK.

Migration from 3.8.0 to 3.9.0

No migration needed.

Migration from 3.7.0 to 3.8.0

No migration needed.

Migration from 3.6.0 to 3.7.0

No migration needed.

Migration from 3.5.1 to 3.6.0

Since we’ve dropped support for iOS 7, deployment target of the app using Applause SDK needs to be set to iOS 8 or higher.
We’ve added a Swift Logger class, so it is required to set Embedded Content Contains Swift Code to Yes in “Build Settings” tab in target settings.
Applause SDK is now an embedded framework, so it will link all necessary frameworks by itself. They can be removed from “Link Binary With Libraries” section of “Build Phases” tab in target settings.
It is recommended to use @import Applause; instead of #import <Applause/APLLogger.h> in Objective-C classes.
There is no need of adding -ObjC and -all_load linker flags, so they can be removed from “Other Linker Flags” in “Build Settings”.
screenShotsFromGallery flag was removed, so all occurences of it’s usage should be removed as well.

Migration from 3.5.0 to 3.5.1

No migration needed.

Migration from 3.4.1 to 3.5.0

No migration needed.

Migration from 3.4.0 to 3.4.1

No migration needed.

Migration from 3.3.0 to 3.4.0

No migration needed.

Migration from 3.2.5 to 3.3.0

Since we’ve dropped support for iOS 6, deployment target of the app using Applause SDK needs to be set to iOS 7 or higher.

Migration from 3.2.4 to 3.2.5

No migration needed.

Migration from 3.2.3 to 3.2.4

No migration needed.

Migration from 3.2.2 to 3.2.3

No migration needed.

Migration from 3.2.1 to 3.2.2

No migration needed.

Migration from 3.2.0 to 3.2.1

No migration needed.

Migration from 3.1.0 to 3.2.0

Since we’ve introduced Bitcode support for the library, to compile the app you need to update Xcode to version 7. Previous version – 3.1.0 – is the last one which supports Xcode 6.

Project Setup Migration

No migration needed.

Library Setup Migration

Integration with uTest is now disabled by default, so in case of using the default value for apps integrated with uTest platform, the value now needs to be set to YES.

Objective-C

[[APLLogger settings] setWithUTest:YES];

Swift

APLLogger.settings().withUTest = true

Migration from 3.0.1 to 3.1.0

No migration needed.

Migration from 3.0.0 to 3.0.1

For users which were affected by the bug APSDK-1944 (messages were not sent when server URL was not set), all sessions saved when running on 3.0.0 will be lost. Upgrading to 3.0.1 will send only new sessions and its messages.

Migration from 2.4.1 to 3.0.0

SDK version 3.0.0 introduced the Screen Recording and major overhaul of internals, which requires additional frameworks added to the project to work. Please also keep in mind that there’s no migration mechanism from sessions stored in 2.4.1 version of the SDK and 3.0.0. Once you’ve update to the newest version all previous data will be lost.

As of version 3.0.0 we’ve also changed deployment target of the library from iOS 5.0 to iOS 6.0.

Project Setup Migration

Cocoapods Integration

No migration needed, CocoaPods will manage all dependencies after updating SDK to the latest version.

Manual Integration

Open Xcode and in project navigator select project file of your application. From the list of targets, select your app target, and select Build Phases tab. Expand the Link Binary With Libraries tab, and press + button below Libraries list. A new window with Choose frameworks and libraries to add: title will pop up. From the list of frameworks, select and add:
* AVFoundation.framework
* CoreData.framework
* CoreMedia.framework
* CoreVideo.framework
* MediaPlayer.framework

No further project settings changes are required at this point.

Migration from 2.4.0 to 2.4.1

No migration needed.

Migration from 2.3.0 to 2.4.0

No migration needed.

Migration from 2.2.3 to 2.3.0

No migration needed.

Migration from 2.2.2 to 2.2.3

No migration needed.

Migration from 2.0.x or 2.1.x to 2.2.2

Starting from 2.2.0, Applause SDK comes in signle binary, as opposed to two binaries for Pre-Production and Production.

Project Setup Migration

Cocoapods Integration

Replace the following entry in your Podfile:

pod 'Applause-SDK-PreProd', '~> 2.1.2'

with the entry:

pod 'Applause-SDK', '~> 2.2.2'

Save the file and re-install pods:

$ pod install

Once it’s finished the new version of the Applause SDK is integrated with your project. Move to section called Code Migration in order to finish migration.

Manual Integration

Step 1: Remove previous version of the Applause SDK

Open Xcode and project navigator find the previous version of the Applause SDK, a file called Applause-Pre-Production.framework. Select the file and delete it (either by pressing Backspace or using context menu). You will be prompted with the following question:

Do you want to move the file “Applause-Pre-Production.framework” to the Trash, or only remove the reference to it?

Select: Move to Trash.

Do the same for the Applause-Production.framework if your app was using it.

This is recommanded way of removing the old Applause SDK, rather then just deleting the file from your project. This way Xcode takes care of removing all references to the SDK from the project settings.

Step 2: Add the new Applause SDK to the 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).

No further project settings changes are required at this point.

Code Migration

Header Imports

Search in your project (in Xcode press Cmd + Shift + F) for:

#import <Applause-Pre-Production/APLLogger.h>

and replace it with:

#import <Applause/APLLogger.h>

This should be the only Applause SDK header import in your code. If for some reason you’ve imported other public headers you should search for Applause-Pre-Production to double check your imports.

Modes

Prior to version 2.2.0 you had to include two frameworks for Pre-Production and Production modes of Applause SDK. Now you can control the mode of the Applause SDK from your code. You can use #ifdef statement and preprocessor macro to switch between modes.

#####Example in Objective-C

Given you’ve added a macro to your project called APP_STORE (under Preprocessor Macros) you could do the following:

#ifdef APP_STORE
[[APLLogger settings] setMode:APLModeMarket];
#else
[[APLLogger settings] setMode:APLModeQA];
#endif
[APLLogger startNewSessionWithApplicationKey:@"Your APP Key goes here"];

#####In Swift:

Swift code can be conditionally compiled with use of build configuration (read more at https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html). You can specify command line flags using -D <#flag#> in other swift flags in project settings. For example, when specified -D Debug for Debug build configuration, and respectively -D Release for Release configuration.

you could do the following:

#if Debug
APLLogger.settings().mode = APLMode.QA
#elseif Release
APLLogger.settings().mode = APLMode.Market
#endif
APLLogger.startNewSessionWithApplicationKey("Your APP Key goes here")

How to symbolicate a crash in iOS

These are instructions how to symbolicate crashes take from the Applause webpanel

This process will take a crash looking like this:-

into something human readable like this :-

  

One time setup:

1.  You need to make sure you have xcode tools installed there’s a guide here.

2.  Make sure you set up the “DEVELOPER_DIR” director to point to them  

export DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"

3.  Find and create an alias for the Apple symbolicatecrash perl script (included in xcode tools)

find /Applications/Xcode.app -name symbolicatecrash -type f

then create an alias to that since the path is going to be quite long

alias symbolicatecrash=’/YOUR.ACTUAL.PATH.TO./symbolicatecrash’

i.e. (alias symbolicatecrash=’/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash’)

  

To symbolicate an individual crash:

1. Go to the crash you’re interested in on the web panel and copy/paste the entire contents into a .crash file (file extension is not mandatory)

2. Find the dSYM file from the build causing the crash (inside the .xcarchive > dSYMs folder)  

3. Run the script:

./symbolicatecrash /path/mycrash.crash /path/MyAppName.app.dSYM > symbolicatedcrash.crash

  

This will create a file called  symbolicatedcrash.crash  that contains the symbolicated crash.

Crashes from the Simulator

Note that unless you have ensured your dSYM files are build to support the Simulator then this  won’t work for crashes sent from the simulator.

  

  

  

Migration from 2.0.x or 2.1.x to 2.2.2

Migration from 3.3.0 to 3.4.0

No migration needed.

Migration from 3.2.5 to 3.3.0

Since we’ve dropped support for iOS 6, deployment target of the app using Applause SDK needs to be set to iOS 7 or higher.

Migration from 3.2.4 to 3.2.5

No migration needed.

Migration from 3.2.3 to 3.2.4

No migration needed.

Migration from 3.2.2 to 3.2.3

No migration needed.

Migration from 3.2.1 to 3.2.2

No migration needed.

Migration from 3.2.0 to 3.2.1

No migration needed.

Migration from 3.1.0 to 3.2.0

Since we’ve introduced Bitcode support for the library, to compile the app you need to update Xcode to version 7. Previous version – 3.1.0 – is the last one which supports Xcode 6.

Project Setup Migration

No migration needed.

Library Setup Migration

Integration with uTest is now disabled by default, so in case of using the default value for apps integrated with uTest platform, the value now needs to be set to YES.

Objective-C

[[APLLogger settings] setWithUTest:YES];

Swift

APLLogger.settings().withUTest = true

Migration from 3.0.1 to 3.1.0

No migration needed.

Migration from 3.0.0 to 3.0.1

For users which were affected by the bug APSDK-1944 (messages were not sent when server URL was not set), all sessions saved when running on 3.0.0 will be lost. Upgrading to 3.0.1 will send only new sessions and its messages.

Migration from 2.4.1 to 3.0.0

SDK version 3.0.0 introduced the Screen Recording and major overhaul of internals, which requires additional frameworks added to the project to work. Please also keep in mind that there’s no migration mechanism from sessions stored in 2.4.1 version of the SDK and 3.0.0. Once you’ve update to the newest version all previous data will be lost.

As of version 3.0.0 we’ve also changed deployment target of the library from iOS 5.0 to iOS 6.0.

Project Setup Migration

Cocoapods Integration

No migration needed, CocoaPods will manage all dependencies after updating SDK to the latest version.

Manual Integration

Open Xcode and in project navigator select project file of your application. From the list of targets, select your app target, and select Build Phases tab. Expand the Link Binary With Libraries tab, and press + button below Libraries list. A new window with Choose frameworks and libraries to add: title will pop up. From the list of frameworks, select and add:

  • AVFoundation.framework
  • CoreData.framework
  • CoreMedia.framework
  • MediaPlayer.framework

No further project settings changes are required at this point.

Migration from 2.4.0 to 2.4.1

No migration needed.

Migration from 2.3.0 to 2.4.0

No migration needed.

Migration from 2.2.3 to 2.3.0

No migration needed.

Migration from 2.2.2 to 2.2.3

No migration needed.

Migration from 2.0.x or 2.1.x to 2.2.2

Starting from 2.2.0, Applause SDK comes in signle binary, as opposed to two binaries for Pre-Production and Production.

Project Setup Migration

Cocoapods Integration

Replace the following entry in your Podfile:

pod 'Applause-SDK-PreProd', '~> 2.1.2'

with the entry:

pod 'Applause-SDK', '~> 2.2.2'

Save the file and re-install pods:

$ pod install

Once it’s finished the new version of the Applause SDK is integrated with your project. Move to section called Code Migration in order to finish migration.

Manual Integration

Step 1: Remove previous version of the Applause SDK

Open Xcode and project navigator find the previous version of the Applause SDK, a file called Applause-Pre-Production.framework. Select the file and delete it (either by pressing Backspace or using context menu). You will be prompted with the following question:

Do you want to move the file ‘Applause-Pre-Production.framework’€ to the Trash, or only remove the reference to it?

Select: Move to Trash.

Do the same for the Applause-Production.framework if your app was using it.

This is recommanded way of removing the old Applause SDK, rather then just deleting the file from your project. This way Xcode takes care of removing all references to the SDK from the project settings.

Step 2: Add the new Applause SDK to the 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 theUIKit.framework, for instance).

No further project settings changes are required at this point.

Code Migration

Header Imports

Search in your project (in Xcode press Cmd + Shift + F) for:

#import <Applause-Pre-Production/APLLogger.h>

and replace it with:

#import <Applause/APLLogger.h>

This should be the only Applause SDK header import in your code. If for some reason you’ve imported other public headers you should search for Applause-Pre-Production to double check your imports.

Modes

Prior to version 2.2.0 you had to include two frameworks for Pre-Production and Production modes of Applause SDK. Now you can control the mode of the Applause SDK from your code. You can use #ifdef statement and preprocessor macro to switch between modes.

Example in Objective-C

Given you’ve added a macro to your project called APP_STORE (under Preprocessor Macros) you could do the following:

#ifdef APP_STORE
[[APLLogger settings] setMode:APLModeMarket];
#else
[[APLLogger settings] setMode:APLModeQA];
#endif
[APLLogger startNewSessionWithApplicationKey:@"Your API Key goes here"];
In Swift:

Swift code can be conditionally compiled with use of build configuration (read more at

https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/InteractingWithCAPIs.html).

You can specify command line flags using -D <#flag#> in other swift flags in project settings. For example, when specified -D Debug for Debug build configuration, and respectively -D Release for Release configuration.

you could do the following:

#if Debug
APLLogger.settings().mode = APLMode.QA
#elseif Release
APLLogger.settings().mode = APLMode.Market
#endif
APLLogger.startNewSessionWithApplicationKey("Your API Key goes here")

iOS SDK Advanced Configuration Options

Changing Settings

You can specify several settings that control how Applause will behave within your app. The settings must be set before starting the actual session (before the startNewSessionWithApplicationKey: method is called) – changing them afterwards will have no effect.

The following settings are modifiable by simple calls to the Applause library:

Mode

The Applause SDK you can work in two modes:

  • QA Mode (APLModeQA): Use this mode to fully activate the Mobile SDK for your testing. When testers start your app, they will be presented with a login screen so that the Applause SDK can associate their bugs with their Applause SDK accounts. Full details about the app and device state are sent with logs, sessions, bug reports, and crash reports. This mode is the default, and in most cases, you should choose this mode
  • Market Mode (APLModeMarket): This mode hides the Applause SDK from the user. They will not be able to login to the Applause SDK server or report bugs from the app.

Default value of mode is APLModeQA or APLMode.QA for Swift.

Objective-C

[[APLLogger settings] setMode:APLModeQA];

Swift

APLLogger.settings().mode = APLMode.QA

Report On Shake

Default is YES. Specifies whether to report bugs by shaking the device.

Objective-C

[[APLLogger settings] setReportOnShakeEnabled:YES];

Swift

APLLogger.settings().reportOnShakeEnabled = true

Gallery Mode

This method was deprecated. By default the SDK supports adding images from the gallery.

Default User

The default value is nil. When a default user email is provided, there will be no login screen and all sessions will be linked to this user. An APLAnonymousUser constant value can be used to link all sessions to the anonymous user.

Objective-C

[[APLLogger settings] setDefaultUser:@"johnsmith@sample.mail"];

Swift

APLLogger.settings().defaultUser = "johnsmith@sample.mail"

Applause Integration

The default value is YES. Activate Applause’s integration with uTest. Set this to NO if you are not an Applause customer and you’re not using Applause SDK with the Applause community. NOTE: This also enables/disables the Feedbackbutton in the SDK UI. If you want to collect user feedback in addition to bugs, this flag should be set to NO. Feedback will be available within the SDK platform’s control panel ([sdk.applause.com]).

Objective-C

[[APLLogger settings] setWithUTest:YES];

Swift

APLLogger.settings().withUTest = true

Mach Exceptions

The default value is nil which means that Applause is using the BSD signal handler. Trap fatal signals via a Mach exception server.

NOTE! The Mach exception handler executes in-process, and will interfere with debuggers. It should not be used with debugging set on!

Objective-C

[[APLLogger settings] setMachExceptionEnabled:YES];

Swift

APLLogger.settings().machExceptionEnabled = true

Server URL

The default server is https://sdk.applause.com. If you are using the SDK in conjunction with an on premise installation then you will have to override this to ensure your applause traffic goes to the right server.

Objective-C

[[APLLogger settings] setServerURL:@”https://your-domain.com”];

Swift

APLLogger.settings().serverURL = "https://your-domain.com"

Send All NSLog To Applause

The default value is NO. Enable it when you want to send all NSLog (NSLogv also) calls to Applause Server.

NOTE! This function uses private API so it may not work on all system versions.

Objective-C

[[APLLogger settings] setSendAllNSLogToApplause:YES];

Swift

APLLogger.settings().sendAllNSLogToApplause = true

Sample code for using advanced configuration

Objective-C

-(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
    [[APLLogger settings] setReportOnShakeEnabled:YES];
    [[APLLogger settings] setScreenShotsFromGallery:YES];
    [[APLLogger settings] setDefaultUser:@"johnsmith@sample.mail"];
    [[APLLogger settings] setWithUTest:YES];
    [[APLLogger settings] setMachExceptionEnabled:NO];
    [[APLLogger settings] setServerURL:@”sdk.applause.com”];
    [APLLogger startNewSessionWithApplicationKey:@"Applause-Application-Key "];
    ...
    return YES;
 }

Swift

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
   APLLogger.settings().reportOnShakeEnabled = true
   APLLogger.settings().screenShotsFromGallery = true
   APLLogger.settings().defaultUser = "johnsmith@sample.mail"
   APLLogger.settings().withUTest = true
   APLLogger.settings().machExceptionEnabled = false
   APLLogger.settings().serverURL = "sdk.applause.com"
   APLLogger.startNewSessionWithApplicationKey("1g60119f909abd70e5929acb5df9ba924d3a71e690g0g2g35290d29")
   ...
   return true
}

Custom Uncaught Exception Handler (Objective-C only)

If you want to set your own exception handler with NSSetUncaughtExceptionHandler(), please call:

externvoid APLUncaughtExceptionHandler(NSException* exception);

from your method, to send unhanded exceptions to Applause:

void MyCustomUncaughtExceptionHandler(NSException* exception) {
...
APLUncaughtExceptionHandler(exception);
}

Triggering Bug Reports Programmatically

You can also invoke the bug reporting screen from inside your own application code. This is useful if you want to add your own UI for bug reporting.

Simply use the following method in your app to trigger the mechanism:

Objective-C

[APLLogger showReportScreen];

Swift

APLLogger.showReportScreen()

You can bind this call to any UI action such as tapping an on-screen button or choosing an option from a menu.

Advanced Logging Methods

Objective-C

In addition to APLLog, for more granular logging, you can use the APLExtendedLog method. This method works just likeAPLLog, however it also allows you to manually tag the log and add a log level. The tag and log level allows you to categorize the logged activity within Applause.

void APLExtendedLog(APLLogLevel level, NSString nsstring_tag, NSString nsstring_format, ...)

The parameters are:

  • level – an enum with one of the following log levels:
    • APLLogLevelFatal
    • APLLogLevelError
    • APLLogLevelWarning
    • APLLogLevelInfo
    • APLLogLevelVerbose
  • nsstring_tag – a string for including a tag
  • nsstring_format – a format containing the log message itself, where “…” is the argument list for the format string

Swift

Swift does not support macros, hence APLLog does not work. That’s why we’ve introduced the following category onAPLLogger to expose logging methods in Swift:

@interface APLLogger (APLSwiftLoggingSupport)
+ (void)log:(NSString *)message; //default info log
+ (void)log:(NSString *)message withLevel:(APLLogLevel)logLevel;
@end

Examples

Objective-C

APLExtendedLog(APLLogLevelWarning, nil, @"APLExtendedLog with a warning log level", nil);
NSString *const tag = @"example_tag";
APLExtendedLog(APLLogLevelVerbose, tag, @"APLExtendedLog with a verbose log level and with tag: %@", tag);

Swift

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

Troubleshooting SDK (iOS)

For  general trouble shooting  with the SDK go here.

SDK Settings (i.e. Server URL, APP Key) are ignored

The number one cause of settings not being applied in the iOS SDK (i.e. the App Key is wrong or the SDK mode is ignore) is that the settings are applied AFTER the session is started.

For example:  

[[APLLogger settings] setMode:APLModeQA];
[APLLogger startNewSessionWithApplicationKey:@"APPKEY_ONE"]; 
[[APLLogger settings] setServerURL:@"https://my-qa-utest.com/"];
[[APLLogger settings] setMode:APLModeMarket]; 

In the above example the URL and Mode (in red) will be ignored. The  iOS SDK will still be in Pre-Production Mode pointing to the default server.

iOS SDK: Under the Hood

How does the Applause iOS SDK catch crashes?

The SDK uses the open source project:  https://www.plcrashreporter.org/

As well as using  the “NSSetUncaughtExceptionHandler” to ensure all crashes are caught by the SDK.

Where is the crash / bug  data stored?

We store all crashes, logs and bug reports in the “Library” folder of the iOS device. Once data is pushed to the server, we remove it from the device.

How often does the  Applause iOS SDK  send data to Applause servers?

This depends on which mode you are using QA or Market and whether the device has connectivity.

In QA Mode (used in pre-production):

– Bugs & Feedback are sent immediately as long as their is connectivity or as soon as connectivity is restored.

– Crashes are stored and sent when the app restarts (this is because there is usually not enough time to send the data at the time of an app crash)

– Logs are sent periodically (when a pre-sized buffer is filled)

 

 

 

 

 

Logging Events to the SDK Server

The Applause SDK allows you to manually log events to the Applause SDK server. This can be useful when you are debugging problems or crash reports submitted by your users because you can track custom defined activities from your application.

Note: You can safely replace all the instances of NSLog in your app with APLLog orAPLExtendedLog. If the Applause SDK is disabled, the logging methods will only log data to the console (behaving just like the built-in NSLog). However, when the Applause SDK is enabled, the logging methods will also log to the Mobile SDK server.

APLLog

Objective-C

APLLog works just like the regular NSLog. APLLog logs the message to the console, just line NSLog. However, APLLog also sends the logged string to the Applause SDK server where it can be reviewed along with crash reports, bug reports, and other session data from the device.

Prototype

void APLLog (NSString *format, ...);

Examples

// This is the standard Applause SDK logging method. It works very similarly to NSLog. 
// (You can even use this method in place of NSLog - data sent to APLLog will 
// still be logged to the console.)

APLLog(@"Example of APLLog", nil);

// An example of the standard Applause SDK logging method with parameters.

APLLog(@"APLLog with a parameter: %@", @"demo parameter");

Once the Applause SDK receives the logged message, it will automatically tag the event with “ApplauseLog.”

Swift

As of 2.1.2 not supported yet.

APLExtendedLog

Objective-C

For more granular logging, you can use the APLExtendedLog method. This method works just like APLLog, however it also allows you to manually tag the log and add a log level. The tag and log level can help you better categorize the logged activity within the Applause SDK.

Prototype

void APLExtendedLog(APLLogLevel level, NSString nsstring_tag, NSString nsstring_format, ...)

The parameters are:

  • level – an enum with one of the following log levels:
    • APLLogLevelFatal
    • APLLogLevelError
    • APLLogLevelWarning
    • APLLogLevelInfo
    • APLLogLevelVerbose
  • nsstring_tag – a string for including a tag
  • nsstring_format – a format containing the log message itself, where “…” is the argument list for the format string

Examples

// Here's an example of the extended logging method with a warning log level and no tags.
APLExtendedLog(APLLogLevelWarning, nil, @"APLExtendedLog with a warning log level", nil);

// Here's an example of the extended logging method with a verbose log level and a custom tag.
NSString *const tag = @"example_tag";
APLExtendedLog(APLLogLevelVerbose, tag, @"APLExtendedLog with a verbose log level and with tag: %@", tag);

Swift

Swift does not support macros, hence APLLog does not work. That’s why we’ve introduced the following category on APLLogger to expose logging methods in Swift:

@interface APLLogger (APLSwiftLoggingSupport)
+ (void)log:(NSString *)message; //default info log
+ (void)log:(NSString *)message withLevel:(APLLogLevel)logLevel;
@end

So in you Swift code you can do the following:

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

Object Logging

Objective-C

The Applause SDK iOS Client Library also allows for object logging which allows you to log each and every message sent to any object created inside your application (with the exception of singleton objects created using Apple’s singleton pattern). To setup object logging, use the following method of the APLLogger:

[APLLogger registerObjectForLogging:self];

Example

Defining the Object
@implementation ExampleLogObject
- (id) init {
    self = [super init];
    if(self) {       
    }

    // This method registers this object for logging with Applause SDK. Messages sent to this object will
    // also be sent to Applause SDK for debugging purposes.
    return [APLLogger registerObjectForLogging:self];
}

- (void) testMethod {
    NSLog(@"testMethod");
}
@end

Important:

  • Object logging is not available for static methods.
  • This method creates another object for each registered object. While this additional object is very lightweight (smaller than NSObject), it can still have an impact on application performance.
Calling the Object

You would use this object, just like normal.

ExampleLogObject *testObject = [[ExampleLogObject alloc] init];
[testObject testMethod];

Swift

This funcionality is not supported in Swift.

Crash Reporting

The Applause SDK will automatically handle uncaught exceptions from your application and send them to the Applause SDK server. When your app crashes, the Applause SDK will record the relevant information and then send the data to the server the next time the app starts.

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 the Mobile SDK so that it can symbolicate your crashes. Symbolication is the process by which the Mobile SDK adds human readable symbol names back to the stack traces for builds which have had their symbols removed. The process of prepping a symbol file for a build is easy, and you can read the instructions in the  Symbolication help article.

Exception Handlers

The Applause SDK automatically records crashes from your application by instructingNSSetUncaughtExceptionHandler to send all uncaught exceptions to the Applause SDK method: APLUncaughtExceptionHandler:

extern void APLUncaughtExceptionHandler(NSException* exception);

Working with the Applause Exception Handler

If you use NSSetUncaughtExceptionHandler by yourself and still would like to report crashes to Appplause SDK, simply call our handler from inside the  function registered for uncaught exceptions.

Example

Let’s say you have your exception handler defined as so, you need to do the following:

void MyUncaughtExceptionHandler(NSException* exception) {
    //Do your stuff here
    APLUncaughtExceptionHandler(exception);
}

If you have correctly configured the uncaught exception handler, then your app will automatically log crashes to the Applause SDK.