Requirements
- iOS or iPadOS 15.0 or later.
- Swift Package Manager, with Xcode 16 or later. Your app can use the Swift 5 or the Swift 6 language mode; the snippets on this page are checked in Swift 6 mode.
Install
Add the packagehttps://github.com/Apsio/apsio-apple-sdk with Swift Package Manager and
link the Apsio product to your app target. There is no tagged release yet; during early
access, use the main branch.
The package depends on KSCrash 2.6.0 for crash
capture. If your app already links KSCrash, Swift Package Manager resolves one copy.
Start
Start Apsio as early as possible: in your SwiftUIApp initializer, or in
application(_:didFinishLaunchingWithOptions:).
start again does nothing. The app key is not a secret: it ships inside your app and
only routes data to your project.
What is recorded
From then on Apsio records, with nothing else to do:- crashes, sent when the app next launches;
- terminations without a crash report (out of memory, watchdog), inferred on the next launch;
- app start time, and screen load times for UIKit view controllers;
- network requests made with
URLSession: method, URL without the query string, host, status and duration; - breadcrumbs for screens, network requests and app lifecycle changes;
- sessions, and the daily MetricKit reports (launch, hangs, memory, CPU, terminations).
Options
traceparent is only added to the hosts you list, never to third parties. Query strings and
request bodies are never recorded.
Users and attributes
Identify the user with a hash you compute. Never pass an email or a name.setAttribute is added to every record from then on; nil removes it.
AttributeValue).
Logs, errors and breadcrumbs
- Log levels are
.trace,.debug,.info,.warn,.errorand.fatal. Logs below the minimum level of the remote configuration (Info by default) are dropped on the device. recordErrorrecords a handled error with its stack. Errors are grouped into issues like crashes;fingerprintreplaces the default grouping. See Crashes and issues.- Breadcrumbs are the steps shown before a crash or an error in the same session.
Spans
Screens in SwiftUI
UIKit view controllers are tracked on their own, named after their class. In SwiftUI, name screens yourself, and report when a screen shows its real content to measure its time to full display:Feature flags
Privacy and consent
start only after the user agrees.
The SDK ships a privacy manifest for each of its modules. Declare crash, performance and
diagnostic data in your App Store privacy label; if you keep the installation id on, also
declare a device ID used for analytics, not linked to the user and not used for tracking.
See Privacy and consent.
Sending now
Records leave in batches. To send what is queued now, for example before a test ends:Background uploads
What is left when the app moves to the background is handed to iOS, which sends it later. Optionally, let iOS know when Apsio’s uploads finish:completionHandler on the main thread. handleBackgroundEvents returns false
for background sessions that are not Apsio’s; handle those as before.
Next
- Upload your dSYMs, so crashes show function names and lines.
- Remote configuration: sampling and capture without a release.