Skip to content

Commit a20792e

Browse files
authored
feat: Add iOS auto-update SDK (#15711)
<!-- Use this checklist to make sure your PR is ready for merge. You may delete any sections you don't need. --> ## DESCRIBE YOUR PR Adding docs for the new update SDK released in iOS v9 ## IS YOUR CHANGE URGENT? Help us prioritize incoming PRs by letting us know when the change needs to go live. - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [X] None: Not urgent, can wait up to 1 week+ ## SLA - Teamwork makes the dream work, so please add a reviewer to your PRs. - Please give the docs team up to 1 week to review your PR unless you've added an urgent due date to it. Thanks in advance for your help! ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
1 parent 9cd9a39 commit a20792e

File tree

8 files changed

+105
-19
lines changed

8 files changed

+105
-19
lines changed

docs/platforms/android/build-distribution/auto-update.mdx

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,7 @@ Make sure your Sentry Java version is at least 8.27.0 and you have the [Sentry A
2121

2222
You'll also need an [internal integration token](#create-an-integration-token) with Build Distribution permissions.
2323

24-
## Create an Integration Token
25-
26-
To use the Auto-Update SDK, you need to create an internal integration token with the appropriate permissions:
27-
28-
1. Navigate to **Settings > Custom Integrations** in your Sentry organization
29-
2. Click **Create New Integration**
30-
![Create New Integration =800x](./images/create-new-integration.png)
31-
32-
3. Select **Internal Integration** and click **Next**
33-
![Internal Integration =600x](./images/internal-integration.png)
34-
35-
4. Give your integration a name (e.g., "Build Distribution")
36-
![Name token =800x](./images/name-token.png)
37-
5. Under **Permissions**, select **Read** next to the **Distribution** scope.
38-
![Set Permissions =800x](./images/set-permissions.png)
39-
6. Click **Save Changes**
40-
7. Scroll down to the Tokens section and click **New Token**
41-
![Create New Token =800x](./images/create-auth-token.png)
42-
8. Copy the generated token to your CI secrets as an environment `SENTRY_DISTRIBUTION_AUTH_TOKEN`
24+
<Include name="build-distribution/create-integration-token" />
4325

4426
## Installation
4527

@@ -79,6 +61,8 @@ sentry {
7961
}
8062
```
8163

64+
This expects to find the environment variable `SENTRY_DISTRIBUTION_AUTH_TOKEN`, copy the token you generated in the preceding step to this variable in your CI environment.
65+
8266
### Configuration Options
8367

8468
| Option | Description | Default |
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
title: Auto-Update SDK
3+
sidebar_title: Auto-Update SDK
4+
sidebar_order: 10
5+
description: Enable automatic update checks and installations for internal iOS builds using the Sentry Auto-Update SDK.
6+
---
7+
8+
<Include name="feature-available-for-user-group-early-adopter" />
9+
10+
<Alert level="warning">
11+
12+
The Auto-Update SDK is designed for **internal builds only** and should never be used in production builds distributed through the App Store.
13+
14+
</Alert>
15+
16+
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.
17+
18+
## Pre-requisites
19+
20+
The SDK can only be installed using Swift Package Manager.
21+
22+
You'll also need an [internal integration token](#create-an-integration-token) with Build Distribution permissions.
23+
24+
<Include name="build-distribution/create-integration-token" />
25+
26+
## Installation
27+
28+
Add a dependency on the `SentryDistribution` target contained in the sentry-cocoa package (https://github.com/getsentry/sentry-cocoa)
29+
30+
```swift {filename:Package.swift}
31+
.package(url: "https://github.com/getsentry/sentry-cocoa", from: "{{@inject packages.version('sentry.cocoa') }}"),
32+
33+
.target(name: "MyTarget", dependencies: ["SentryDistribution"]),
34+
```
35+
36+
## Usage
37+
38+
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:
39+
40+
```swift {filename:MyView.swift}
41+
import SentryDistribution
42+
import SwiftUI
43+
44+
struct MyView: View {
45+
var body: some View {
46+
Button("Check For Update") {
47+
let params = CheckForUpdateParams(
48+
accessToken: "MY_TOKEN",
49+
organization: "___ORG_SLUG___",
50+
project: "___PROJECT_SLUG___")
51+
Updater.checkForUpdate(params: params) { result in
52+
handleUpdateResult(result: result)
53+
}
54+
}
55+
}
56+
57+
static func handleUpdateResult(result: Result<UpdateCheckResponse, Error>) {
58+
guard case let .success(releaseInfo) = result else {
59+
// Handle error
60+
return
61+
}
62+
63+
guard let releaseInfo = releaseInfo.update else {
64+
print("Already up to date")
65+
return
66+
}
67+
68+
guard let url = Updater.buildUrlForInstall(releaseInfo.downloadUrl) else {
69+
return
70+
}
71+
DispatchQueue.main.async {
72+
Updater.install(url: url)
73+
}
74+
}
75+
}
76+
```
77+
78+
## Security Considerations
79+
80+
- **Internal Use Only**: Never ship the auto-update SDK in production builds destined for public app stores
81+
- **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.
82+
83+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Create an Integration Token
2+
3+
To use the Auto-Update SDK, you need to create an internal integration token with the appropriate permissions:
4+
5+
1. Navigate to **Settings > Custom Integrations** in your Sentry organization
6+
1. Click **Create New Integration**
7+
![Create New Integration =800x](./images/create-new-integration.png)
8+
9+
1. Select **Internal Integration** and click **Next**
10+
![Internal Integration =600x](./images/internal-integration.png)
11+
12+
1. Give your integration a name (e.g., "Build Distribution")
13+
![Name token =800x](./images/name-token.png)
14+
1. Under **Permissions**, select **Read** next to the **Distribution** scope.
15+
![Set Permissions =800x](./images/set-permissions.png)
16+
1. Click **Save Changes**
17+
1. Scroll down to the Tokens section and click **New Token**
18+
![Create New Token =800x](./images/create-auth-token.png)
19+
1. Save the generated token, you'll need it to integrate the SDK

docs/platforms/android/build-distribution/images/create-auth-token.png renamed to includes/build-distribution/images/create-auth-token.png

File renamed without changes.

docs/platforms/android/build-distribution/images/create-new-integration.png renamed to includes/build-distribution/images/create-new-integration.png

File renamed without changes.

docs/platforms/android/build-distribution/images/internal-integration.png renamed to includes/build-distribution/images/internal-integration.png

File renamed without changes.

docs/platforms/android/build-distribution/images/name-token.png renamed to includes/build-distribution/images/name-token.png

File renamed without changes.

docs/platforms/android/build-distribution/images/set-permissions.png renamed to includes/build-distribution/images/set-permissions.png

File renamed without changes.

0 commit comments

Comments
 (0)