Backtrace 2.0.0

Backtrace 2.0.0

Maintained by Rick Foster.

Backtrace 2.0.0

  • By
  • Backtrace I/O

Backtrace Integration with iOS

Supported platforms Supported languages CocoaPods compatible License: MIT Build Status

Backtrace's integration with iOS, macOS, and tvOS applications allows you to capture and report handled and unhandled exceptions so you can prioritize and debug software errors.


You can use this SDK through either Swift Package Manager or CocoaPods. The SPM package can be integrated directly within Xcode or by editing your package's Package.swift file.
Choose one of the following integration methods.

Via Xcode

  1. In File > Add Packages, search for and add
  2. Verify your project Package Dependencies list backtrace-cocoa.
  3. Add Backtrace to your target’s Frameworks, Libraries, and Embedded Content.

Via Package.swift

Add this dependency to your Package.swift file:

.package(url: "

Via CocoaPods

Add the following to your Podfile:

  • Specify use_frameworks!.
  • Add the Backtrace pod:
    pod 'Backtrace'



let backtraceCredentials = BacktraceCredentials(endpoint: URL(string: Keys.backtraceUrl as String)!,
token: Keys.backtraceToken as String)
let backtraceDatabaseSettings = BacktraceDatabaseSettings()
backtraceDatabaseSettings.maxRecordCount = 10
let backtraceConfiguration = BacktraceClientConfiguration(credentials: backtraceCredentials,
dbSettings: backtraceDatabaseSettings,
reportsPerMin: 10,
allowsAttachingDebugger: true,
detectOOM: true)
BacktraceClient.shared = try? BacktraceClient(configuration: backtraceConfiguration)
BacktraceClient.shared?.attributes = ["foo": "bar", "testing": true]
do {
try throwingFunc()
} catch {
BacktraceClient.shared?.send(attachmentPaths: []) { (result) in


BacktraceCredentials *credentials = [[BacktraceCredentials alloc]
initWithEndpoint: [NSURL URLWithString: Keys.backtraceUrl]
token: [Keys backtraceToken]];
BacktraceDatabaseSettings *backtraceDatabaseSettings = [[BacktraceDatabaseSettings alloc] init];
backtraceDatabaseSettings.maxRecordCount = 10;
BacktraceClientConfiguration *configuration = [[BacktraceClientConfiguration alloc]
initWithCredentials: credentials
dbSettings: backtraceDatabaseSettings
reportsPerMin: 3
allowsAttachingDebugger: TRUE
detectOOM: TRUE];
BacktraceClient.shared = [[BacktraceClient alloc] initWithConfiguration: configuration error: nil];
BacktraceClient.shared.attributes = @{@"foo": @"bar", @"testing": @YES};
BacktraceClient.shared.attachments = [NSArray arrayWithObjects:fileUrl, nil];
// sending NSException
@try {
NSArray *array = @[];
array[1]; // will throw exception
} @catch (NSException *exception) {
[[BacktraceClient shared] sendWithAttachmentPaths: [NSArray init] completion: ^(BacktraceResult * _Nonnull result) {
NSLog(@"%@", result);
} @finally {


For more information about the iOS SDK, including installation, usage, and configuration options, see the iOS Integration guide in the Sauce Labs documentation.