Auto-Update SDK
Enable automatic update checks and installations for internal iOS builds using the Sentry Auto-Update SDK.
This feature is available only if you're in the Early Adopter program. Features available to Early Adopters are still in-progress and may have bugs. We recognize the irony.
The Auto-Update SDK is designed for internal builds only and should never be used in production builds distributed through the App Store.
The Sentry Auto-Update SDK enables your internal iOS builds to automatically check for and install newer versions distributed through Sentry's Build Distribution. This is particularly useful for distributing nightly, alpha, or beta builds to your internal teams. It is not required to use the Sentry crash reporting SDK to use the iOS Auto-Update SDK.
The SDK can only be installed using Swift Package Manager.
You'll also need an internal integration token with Build Distribution permissions.
To use the Auto-Update SDK, you need to create an internal integration token with the appropriate permissions:
Navigate to Settings > Custom Integrations in your Sentry organization
Click Create New Integration
Select Internal Integration and click Next
Give your integration a name (e.g., "Build Distribution")
Under Permissions, select Read next to the Distribution scope.
Click Save Changes
Scroll down to the Tokens section and click New Token
Save the generated token, you'll need it to integrate the SDK
Add a dependency on the SentryDistribution target contained in the sentry-cocoa package (https://github.com/getsentry/sentry-cocoa)
Package.swift.package(url: "https://github.com/getsentry/sentry-cocoa", from: "9.6.0"),
.target(name: "MyTarget", dependencies: ["SentryDistribution"]),
Use the SDK by calling Updater.checkForUpdate(params: ). In addition to the access token, provide your Sentry org and project slug in the CheckForUpdateParams. For example:
MyView.swiftimport SentryDistribution
import SwiftUI
struct MyView: View {
var body: some View {
Button("Check For Update") {
let params = CheckForUpdateParams(
accessToken: "MY_TOKEN",
organization: "___ORG_SLUG___",
project: "___PROJECT_SLUG___")
Updater.checkForUpdate(params: params) { result in
handleUpdateResult(result: result)
}
}
}
static func handleUpdateResult(result: Result<UpdateCheckResponse, Error>) {
guard case let .success(releaseInfo) = result else {
// Handle error
return
}
guard let releaseInfo = releaseInfo.update else {
print("Already up to date")
return
}
guard let url = Updater.buildUrlForInstall(releaseInfo.downloadUrl) else {
return
}
DispatchQueue.main.async {
Updater.install(url: url)
}
}
}
- Internal Use Only: Never ship the auto-update SDK in production builds destined for public app stores
- Token Security: The distribution token is embedded in the app and can be extracted by reverse engineering. Use tokens with only the distribution read permission which is the minimum required permission for the auto-update SDK.
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").