Mobile SDK

Error monitoring for Apple platforms

A Swift package for iOS, macOS, tvOS, and watchOS. It installs an uncaught-exception handler and auto-attaches device metadata, with a manual `notify` for handled errors.

Frameworks iOS · macOS · tvOS · watchOSRequires Swift 5.9+ · iOS 14+ · macOS 11+Package Errorgap (SwiftPM)Source ↗Agent guide ↗
Install

Install

Add the package in Package.swift (or Xcode → File → Add Packages…) and add "Errorgap" to your target's dependencies:

swift
.package(url: "https://github.com/errorgaphq/errorgap-swift.git", from: "0.2.0")
Configure

Configure

In your app's launch path:

swift
import Errorgap

Errorgap.initialize(ErrorgapConfiguration(
    endpoint:    "https://your-endpoint",
    projectSlug: "your-project",
    apiKey:      ProcessInfo.processInfo.environment["ERRORGAP_API_KEY"],
    release:     Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
))

By default the SDK installs NSSetUncaughtExceptionHandler and attaches device metadata (os_name, app_version, device_model, …). Pass captureGlobals: false to skip the global hook.

Trigger a test error

Trigger a test error

swift
Errorgap.notify(NSError(domain: "ErrorgapTest", code: 0, userInfo: [
    NSLocalizedDescriptionKey: "Errorgap test error"
]))
Verify

Verify the connection

Confirm your key and endpoint reach errorgap before wiring anything else — send one event straight to the ingestion API:

bash
curl -sS -X POST "$ERRORGAP_ENDPOINT/api/projects/$ERRORGAP_PROJECT_SLUG/notices" \
  -H "content-type: application/json" \
  -H "x-errorgap-project-key: $ERRORGAP_API_KEY" \
  -d '{"errors":[{"type":"ErrorgapInstallTest","message":"Errorgap install verification"}]}'

A 201 with a group_id means ingestion works (202 = received but sampled; 401 = wrong key). Then trigger the test error above through the SDK. Your onboarding screen's Verify step checks the stack off automatically once the first event lands — it polls every three seconds.

Next: the full ingestion API, or browse every SDK.