Type 'Client' has no member 'shared' iOS

I’m here to new using Sentry Cocoa latest sdk in iOS project. While sending event I’m getting this error.
let event = Event(level: .debug)
event.message = "Test Message "
Client.shared?.send(event: event) { (error) in
// Optional callback after event has been sent
Type ‘Client’ has no member ‘shared’ error occurred.
How can I send an event ?

The Sentry cocoa SDK version 5 and later doesn’t have Client.shared. That’s from the version 4.

I suggest taking a look at the docs for the current version:


All that doc says is " Make sure you initialize the SDK as soon as possible in your application lifecycle e.g. in your AppDelegate application:didFinishLaunchingWithOptions method:"

It does not show how to initialize it! That’s not helpful. What am I missing?

You’re right. We’ve just shuffled things around in the docs and seems like we dropped the sample on how to initialize the SDK.

Until we fix that, please take a look at the repository, it has the initialization snippet:

In Swift, with the latest SDK installation:

import Sentry

SentrySDK.start { options in
    options.dsn = "___PUBLIC_DSN___"

When you create a new project in Sentry, you can select a platform. Which one did you pick?
There’s one there for Swift that should be helpful. I’ve checked now and it has the snippet above.

1 Like