Error and Crash Reporting in iOS App Extensions with Backtrace

Sauce AI for Test Authoring: Move from intent to performance in minutes.|xBack to ResourcesBlogPosted<

May 26, 2026 · 5 min read · Mobile Testing

Sauce AI for Test Authoring: Move from intent to performance in minutes.

|

x

Back to Resources

Blog

Posted May 25, 2023

Error and Crash Reporting in iOS App Extensions with Backtrace

In this article,we are going to guide a look at how Backtrace SDK can help to automatically detect and account handled and unhandled exception, errors, and crashes that happen in your apps.

quote

We are living in a time where richer inter-app communication and taut integrating with the OS service is available in mobile, and iOS is no exception.iOS App extensionsenable you to run your range beyond the process of presenting the UI. You can fascinate screen, intercept network, or interact with an Apple Watch while other apps are scarper in the foreground.

These extensions run in their own, sandboxed operation, and take additional care to monitor them in product. In this post, we are going to take a look at how Backtrace SDK can facilitate us in our example Keyboard Extension.

You can find a pair of sample projects below if you prefer jumping right into it.

Requirements

You & # x27; ll need the latest Xcode and backtrace-cocoa SDK. CocoaPods CLI is not necessitate.

Steps

Download SDK

Download the latest archive from backtrace-cocoareleases. Make sure you pick bitcode=YES embedded=YES smell.

Launch your Xcode projection.

Copy these into your project root by drag and dropping them into Project Navigator.

  • Rome/Backtrace.framework

  • Rome/Backtrace_PLCrashReporter.framework

  • Rome/Cassette.framework

Select your app and all extensions in the prompted dialog.

For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users.

Error Monitoring Dialog Box

Configure Xcode Project

  1. Navigate to each build mark & # x27; s General settings (i.e., your app and each extension).

  2. Locate Framework, Libraries, and Embedded Content for apps and Frameworks and Libraries for extensions.

  3. Add all the new frameworks to your targets if missing. Set plant settings as Embed without Signing.

  4. Navigate to Build Phases & gt; Embed Frameworks and make sure all the frameworks are bring there (app and extension targets).

  5. Navigate to Build Settings and change Debug Information Format to Dwarf with dSYM File (app and extension targets).

Add Sources

  • Create a new directory with Finder in your project and name it Backtrace.

  • Copy all & quot; .h & quot; files in Backtrace.framework/Headers and Backtrace_PLCrashReporter.framework/Headers into the newly make directory.

  • Go back to Xcode and add Backtrace by drag & amp; dropping it into Project Navigator. If you get prompted to add bridge header files, accept it.

  • Make certain file are added to all targets in the prompted dialog.

Create a new Obj-C class in your project (i.e., BacktraceWrapper.h and BacktraceWrapper.m). If asked, allow Xcode to create bridging lintel for the mark that utilize Swift.

BacktraceWrapper.h

1
#import<Foundation/Foundation.h>
2
3
NS_ASSUME_NONNULL_BEGIN
4
5
@interfaceBacktraceWrapper:NSObject
6
7
+(void)sendError:(NSError*)error attributes:(NSDictionary*)extra;
8
9
@end
10
11
NS_ASSUME_NONNULL_END

BacktraceWrapper.m

1
#import& quot; BacktraceWrapper.h & quot;
2
#ifdefined(__arm64__)& amp; & amp; __arm64__
3
#import& quot; Backtrace-Swift.h & quot;
4
#import& quot; Backtrace-PLCrashReporter-umbrella.h & quot;
5
#endif
6
7
@ executionBacktraceWrapper
8
9
# pragma markGlobals
10
#ifdefined(__arm64__)& amp; & amp; __arm64__
11
staticBacktraceClient* client;
12
#endif
13
14
# pragma markPrivate
15
16
+(void)initializeBacktrace{
17
#ifdefined(__arm64__)& amp; & amp; __arm64__
18
if(client != nil){
19
return;
20
}
21
22
BacktraceCredentials*credentials=[[BacktraceCredentials alloc]initWithSubmissionUrl:[NSURLURLWithString: @& quot; https: //submit.backtrace.io/BACKTRACE_SUBDOMAIN/BACKTRACE_SUBMISSION_TOKEN/plcrash & quot;]];
23
24
BacktraceDatabaseSettings*dbSettings=[[BacktraceDatabaseSettings alloc] init];
25
dbSettings.maxRecordCount=10;
26
27
BacktraceClientConfiguration*conformation=[[BacktraceClientConfiguration alloc]
28
initWithCredentials:credentials
29
dbSettings:dbSettings
30
reportsPerMin:30// Default is 30
31
allowsAttachingDebugger:FALSE// If mistaken, disables backtrace during development
32
detectOOM:FALSE];
33
34
35
BacktraceCrashReporter*crashReporter=[[BacktraceCrashReporter alloc]initWithConfig:PLCrashReporterConfig.defaultConfiguration];
36
client =[[BacktraceClient alloc]initWithConfiguration:configuration crashReporter:crashReporter error:nil];
37
38
[client.metricsenableWithSettings:[[BacktraceMetricsSettings alloc] init]];
39
#endif
40
}
41
42
43
# pragma markPublic
44
45
+(void)sendError:(NSError*)error attributes:(NSDictionary*)extra {
46
#ifdefined(__arm64__)& amp; & amp; __arm64__
47
[self initializeBacktrace];
48
[client sendWithError:fault attachmentPaths:@[]completion:^(BacktraceResult*_Nonnull result){
49
NSLog(@& quot; Backtrace error sent: % @ & quot;,[error description]);
50
}];
51
#endif
52
}
53
54
@end

Fleet Support

If you want to unwrap BacktraceWrapper to your SWIFT files, add the following line to your bridging headers:

# import & quot; BacktraceWrapper.h & quot;

BacktraceWrapper.sendError (fault: Error) will turn available to your Swift code.

Upload Symbols with CI

Once you are ready to distribute your app, run the commands below in your CI to upload debug symbol to Backtrace.

1
cd $DERIVED_DATA_PATH/Build/Products/Debug-iphoneos/
2
3
zip -r symbols.zip*.dSYM
4
curl --fail-with-body --data-binary @ symbols.zip-XPOST-H& quot; Expect: gzip & quot;& quot; https: //submit.backtrace.io/ $ BACKTRACE_SUBDOMAIN/ $ BACKTRACE_SYMBOLS_ACCESS_TOKEN/symbols & quot;
5

Terminal Words

From now on, your extensions will have the same error coverage capabilities that your app has. We cognize how painful it can become to debug custom keyboards or video calls in production particularly when they ram taciturnly with no utilitarian error substance. Those day are now in the yesteryear.

We ’ d love to hear your feedback! We have late added support for Swift Package Manager which will simplify working with App Extensions yet further.

This article was originally published in January 2023 and has been updated in May 2023.

Diego Perini

Sr. Software Engineer

Published:
May 25, 2023
Share this post
Copy Share Link
LinkedIn
© 2026 Sauce Labs Inc., all rights reserved. SAUCE and SAUCE LABS are register earmark owned by Sauce Labs Inc. in the United States, EU, and may be registered in other jurisdictions.
robot
quote

Automate This With SUSA

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed.

Try SUSA Free

Test Your App Autonomously

Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.

Try SUSA Free