watchOS
Sentry's SDKs report an error automatically whenever a thrown error or exception goes uncaught in your application causing the application to crash. Sentry's iOS, tvOS, and watchOS SDK hook into all signal and exception handlers, except for MacOS.
The SDK builds a crash report that persists to disk and tries to send the report right after the crash. Since the environment may be unstable at the crash time, the report is guaranteed to send once the application is started again.
Features:
- Events enriched with device data
- Offline caching when a device is unable to connect; we send a report once we receive another event
- Breadcrumbs automatically captured for
- Application lifecycle events (
didBecomeActive
,didEnterBackground
,viewDidAppear
) - Touch events
- System events (battery level or state changed, memory warnings, device orientation changed, keyboard did show and did hide, screenshot taken)
- Application lifecycle events (
- Release Health tracks crash free users and sessions
- Attachments enrich your event by storing additional files, such as config or log files
- User Feedback provides the abiity to collect user information when an event occurs
If you're using a version of the SDK between 6.0.2 and 6.0.8, we highly recommend upgrading to the latest version to avoid a regression that affected the quality of the stack traces and error messages.
If you're using self-hosted Sentry, as of version 6.0.0 of the SDK, version 20.6.0 of self-hosted Sentry or greater is required.
On this page, we get you up and running with Sentry's SDK, so that it will automatically report errors and exceptions in your application.
Don't already have an account and Sentry project established? Head over to sentry.io, then return to this page.
Install
Sentry captures data by using an SDK within your application’s runtime.
The minimum version for watchOS is 2.0. Our SDK has limited symbolication support and no crash handling for watchOS.
We recommend installing the SDK with CocoaPods. To integrate Sentry into your Xcode project, specify it in your Podfile
:
platform :watchos, '2.0'
use_frameworks! # This is important
target 'YourApp' do
pod 'Sentry', :git => 'https://github.com/getsentry/sentry-cocoa.git', :tag => '6.2.1'
end
Then run pod install
.
We also support alternate installation methods.
Configure
Configuration should happen as early as possible in your application's lifecycle.
You should also initialize the SDK as soon as possible, such as in your AppDelegate application:didFinishLaunchingWithOptions
method:
import Sentry // Make sure you import Sentry
// ....
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
SentrySDK.start { options in
options.dsn = "https://examplePublicKey@o0.ingest.sentry.io/0"
options.debug = true // Enabled debug when first installing is always helpful
}
return true
}
Provide Debug Information
Before capturing crashes, you need to provide debug information to Sentry. Debug information is provided by uploading dSYM files using one of two methods, dependent on your setup:
Verify
This snippet includes an intentional error, so you can test that everything is working as soon as you set it up:
import Sentry
SentrySDK.crash()
Crash Handling
Our SDK hooks into all signal and exception handlers, except for MacOS. If you are using MacOS, please follow the additional steps documented in Capturing Uncaught Exceptions in macOS.
To try it out, the SDK provides a test crash function:
import Sentry
SentrySDK.crash()
Crashes are submitted only upon re-launch of the application. If you crash with a debugger attached, nothing will happen. To view the crash in Sentry, close your app and re-launch it.
Errors triggered from within Browser DevTools are sandboxed, so will not trigger an error handler. Place the snippet directly in your code instead. Learn more about manually capturing an error or message in our Usage documentation.
To view and resolve the recorded error, log into sentry.io and open your project. Clicking on the error's title will open a page where you can see detailed information and mark it as resolved.
- Package:
- cocoapods:sentry-cocoa
- Version:
- 6.2.1
- Repository:
- https://github.com/getsentry/sentry-cocoa