---
title: "Migrate from 5.x to 6.x"
description: "Learn about migrating from Sentry Cocoa SDK 5.x to 6.x."
url: https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6/
---

# Migrate from 5.x to 6.x | Sentry for iOS

Migrating to 6.x from 5.x includes a few breaking changes. We provide this guide to help you to update your SDK.

## [Configuration Changes](https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6.md#configuration-changes)

This version includes the following configuration changes:

* [Auto Session Tracking](https://github.com/getsentry/sentry-cocoa/blob/7876949ca78aebfe7883432e35727993c5c30829/Sources/Sentry/include/SentryOptions.h#L101) is enabled by default. [This feature](https://docs.sentry.io/product/releases/health.md) is collecting and sending health data about the usage of your application.
* [Attach stack traces](https://github.com/getsentry/sentry-cocoa/blob/b5bf9769a158c66a34352556ade243e55f163a27/Sources/Sentry/Public/SentryOptions.h#L109) is enabled per default.
* We bumped the minimum iOS version to 9.0.
* Use a BOOL in SentryOptions instead of NSNumber to store booleans.
* We had previously removed the [enabled](https://github.com/getsentry/sentry-cocoa/blob/5.2.2/Sources/Sentry/include/SentryOptions.h#L63) option from SentryOptions, but we brought it back in version 6.0.7 with slightly changed functionality. Previously setting an empty or incorrect DSN also set `enabled` to `false`. This side effect is removed. Setting the DSN has no impact on `enabled`. If the DSN is nil or empty or `enabled` is set to `false` and the client won't send any data to Sentry.

## [Breaking Changes](https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6.md#breaking-changes)

### [Store Endpoint](https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6.md#store-endpoint)

This version uses the [envelope endpoint](https://develop.sentry.dev/sdk/data-model/envelopes/). If you are using self-hosted Sentry, you must use Sentry version `>= v20.6.0` or higher. If you are using sentry.io, there is no impact. For this change, we also now cache events in envelopes on the disk. We decided not to migrate the few cached events from 5.x to 6.x into envelopes. Instead, we remove them from the disk. As a result, you might lose a few cached events when upgrading.

### [SDK Inits](https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6.md#sdk-inits)

We removed the [deprecated SDK inits](https://github.com/getsentry/sentry-cocoa/blob/5.2.2/Sources/Sentry/include/SentrySDK.h#L35-L47). The recommended way to initialize Sentry is now:

```swift
import Sentry

SentrySDK.start { options in
    options.dsn = "___PUBLIC_DSN___"
    // ...
}
```

### [Cleanup Public Headers](https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6.md#cleanup-public-headers)

We cleaned up our public headers and made most of our classes private. If you can't access one of the classes you need please [open an issue](https://github.com/getsentry/sentry-cocoa/issues/new/choose) and tell us your use case so we can evaluates whether to either make the class public again or provide another API for you.

### [New type SentryId for eventId](https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6.md#new-type-sentryid-for-eventid)

In 5.x, we used a nullable NSString to represent an event ID. The SDK, Hub, and Client returned this nullable NSString for the event ID to capture messages, events, errors, and so forth. In 6.x, we have a new type SentryId, which is not nullable, to represent an event ID. Instead of returning `nil` when an event couldn't be queued for submission we return `SentryId.empty`.

Example in 5.x:

```swift
import Sentry

let eventId = SentrySDK.capture(message: "A message")
if (nil != eventId) {
    // event was queued for submission
} else {
    // event wasn't queued for submission
}
```

Example in 6.x:

```swift
import Sentry

let eventId = SentrySDK.capture(message: "A message")
if (eventId != SentryId.empty) {
    // event was queued for submission
} else {
    // event wasn't queued for submission
}
```

### [New type SentryMessage for Event.message](https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6.md#new-type-sentrymessage-for-eventmessage)

In 6.x, we introduce a new type [SentryMessage](https://develop.sentry.dev/sdk/foundations/transport/event-payloads/message/) for `event.message`. SentryMessage provides you the ability to pass a format string with parameters to Sentry, which can help group similar messages into the same issue.

Example in 5.x:

```swift
import Sentry

let event = Event()
event.message = "Hello World"
```

Example in 6.x:

```swift
import Sentry

let event = Event()
event.message = SentryMessage(formatted: "Hello World")
```

### [Make Scope nonnull for capture methods](https://docs.sentry.io/platforms/apple/guides/ios/migration/v5-to-v6.md#make-scope-nonnull-for-capture-methods)

In 5.x, you could pass a nullable scope to capture methods of the SDK, Hub, and Client, such as `SentrySdk.captureMessage()`. In 6.x, we changed the Scope to nonnull and provide overloads for the Hub and the Client.

Please see the [Changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md) for a complete list of changes.
