Crash Reporting
Real-time error monitoring and crash reporting for all platforms.
Overview
The Crash Reporting tool helps you monitor errors and crashes in your applications. When something goes wrong, you'll know about it immediately with detailed stack traces and device information.
Features
- Real-time crash monitoring
- Detailed stack traces with source mapping
- Smart crash grouping
- Device and OS information
- User impact tracking
- 90-day data retention
Enabling Crash Reporting
- Open your project in SureProgramming
- In the Tools section, toggle on "Crashes"
- Copy the API key shown in the API Keys section
- Integrate the SDK into your application (see below)
SDK Installation
Choose the SDK for your platform:
iOS (Swift/Objective-C)
Add to your Podfile:
pod 'SureProgrammingCrashes', '~> 1.0'
Or with Swift Package Manager, add:
https://github.com/sureprogramming/crashes-ios.git
Initialize in your AppDelegate:
import SureProgrammingCrashes
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SPCrashes.start(apiKey: "YOUR_API_KEY")
return true
}
}
Android (Kotlin/Java)
Add to your app's build.gradle:
dependencies {
implementation 'com.sureprogramming:crashes:1.0.0'
}
Initialize in your Application class:
class MyApplication : Application() {
override fun onCreate() {
super.onCreate()
SPCrashes.start(this, "YOUR_API_KEY")
}
}
Web (JavaScript/TypeScript)
Install via npm:
npm install @sureprogramming/crashes
Initialize in your app entry point:
import { SPCrashes } from '@sureprogramming/crashes';
SPCrashes.start({
apiKey: 'YOUR_API_KEY',
environment: 'production'
});
Desktop (macOS/Windows)
For Electron apps, use the Web SDK. For native apps:
macOS (Swift):
// Same as iOS SDK
import SureProgrammingCrashes
SPCrashes.start(apiKey: "YOUR_API_KEY")
Windows (C#):
// Install via NuGet
Install-Package SureProgramming.Crashes
// Initialize
SPCrashes.Start("YOUR_API_KEY");
Configuration Options
iOS/macOS
SPCrashes.start(
apiKey: "YOUR_API_KEY",
options: SPCrashesOptions(
enableNetworkErrorTracking: true,
enableANRDetection: true,
environment: "production"
)
)
Android
SPCrashes.start(this, "YOUR_API_KEY") {
enableNetworkErrorTracking = true
enableANRDetection = true
environment = "production"
}
Web
SPCrashes.start({
apiKey: 'YOUR_API_KEY',
environment: 'production',
enableConsoleCapture: true,
enableNetworkCapture: true,
beforeSend: (event) => {
// Filter or modify events before sending
return event;
}
});
Manual Error Reporting
In addition to automatic crash capture, you can manually report errors:
iOS/macOS
do {
try riskyOperation()
} catch {
SPCrashes.report(error)
}
Android
try {
riskyOperation()
} catch (e: Exception) {
SPCrashes.report(e)
}
Web
try {
riskyOperation();
} catch (error) {
SPCrashes.report(error);
}
Adding Context
Add user and custom context to help with debugging:
User Information
// Set user info when they log in
SPCrashes.setUser({
id: 'user123',
email: 'user@example.com',
name: 'John Doe'
});
// Clear when they log out
SPCrashes.clearUser();
Custom Tags
// Add tags for filtering
SPCrashes.setTag('subscription', 'premium');
SPCrashes.setTag('feature_flag_x', 'enabled');
Breadcrumbs
// Leave breadcrumbs to track user actions
SPCrashes.addBreadcrumb({
message: 'User tapped checkout button',
category: 'ui',
level: 'info'
});
Viewing Crashes
Access your crash reports by clicking "Open" on the Crashes tool in your project. You'll see:
- Dashboard - Overview of crash trends and impact
- Issues - Grouped crash reports
- Stack Traces - Detailed error information
- Device Info - OS version, device model, etc.
Source Maps (Web)
For JavaScript apps, upload source maps to get readable stack traces:
# Upload source maps after build
npx @sureprogramming/cli upload-sourcemaps \
--api-key YOUR_API_KEY \
--app-version 1.0.0 \
--path ./dist
dSYM Files (iOS)
For iOS crash symbolication, upload dSYM files:
# Upload dSYMs after archive
npx @sureprogramming/cli upload-dsyms \
--api-key YOUR_API_KEY \
--path ~/Library/Developer/Xcode/Archives/...
Or add a build phase script:
if [ "$CONFIGURATION" == "Release" ]; then
/path/to/sp-cli upload-dsyms \
--api-key $SP_API_KEY \
--path "${DWARF_DSYM_FOLDER_PATH}"
fi
Best Practices
- Initialize early - Call start() as early as possible in your app lifecycle
- Set user context - Helps identify affected users
- Use breadcrumbs - Track user actions leading to crashes
- Upload symbols - Source maps and dSYMs make debugging easier
- Test in development - Use a separate project for dev/staging