Verify Unified SDK for Swift events

이 페이지는 아직 귀하의 언어로 번역되지 않았습니다. 현재 작업 중이므로 곧 다시 확인해 주십시오.

The Unified SDK for Swift sends analytics events through the bundled iOS Swift SDK. An analytics event moves through the same four stages as in the iOS Swift SDK: captured, transformed, sent, and received. This page covers the checks specific to the Unified SDK, starting with setup, and links to the iOS Swift SDK steps for the other stages.

For problems common to every Amplitude SDK, go to SDK troubleshooting and debugging. For changes between versions, go to the AmplitudeUnified changelog.

Turn on debug logging

In Swift, the Unified initializer has no log level option. The initializer always sets the logger to warn, even when you pass ConsoleLogger(logLevel:) with a different level. Raise the level on the logger after you create the instance:

swift
let amplitude = Amplitude(apiKey: "YOUR_API_KEY")
amplitude.configuration.loggerProvider.logLevel = LogLevelEnum.debug.rawValue

If you set amplitude.configuration.logLevel after initialization, the change has no effect. Set loggerProvider.logLevel instead.

The SDK writes its messages with os_log, under the subsystem Amplitude and category Logging. Debug output includes lines such as Start flushing 1 events and Successfully completed request. For what each message means, go to Turn on debug logging in the iOS Swift SDK. Return the level to warn before you ship.

Check that each product initialized

Check each product through its property on the instance:

swift
let amplitude = Amplitude(
    apiKey: "YOUR_API_KEY",
    sessionReplayConfig: SessionReplayPlugin.Config(sampleRate: 1.0)
)

print(amplitude.experiment != nil)    // true
print(amplitude.sessionReplay != nil) // true on iOS

amplitude.experiment returns nil when the instance has more than one Feature Experiment plugin. Go to Read the Experiment client.

While Session Replay records, every event the SDK sends carries an [Amplitude] Session Replay ID event property. If events lack that property, Session Replay isn't recording. Confirm that sampleRate is above 0, and look for this warning, which means the SDK couldn't fetch the Session Replay remote configuration: [SessionReplay] Remote Config unavailable; keeping the current targeting state.

Check what the SDK sent

Each Unified SDK event has a library field with two parts:

json
{
  "event_type": "Sign Up Clicked",
  "library": "amplitude-swift-unified/0.0.0-amplitude-swift/1.19.4"
}

The first part, amplitude-swift-unified/0.0.0, marks the event as sent through the Unified SDK. Its version is always 0.0.0, whichever AmplitudeUnified version you install. The second part, amplitude-swift/1.19.4, is the bundled iOS Swift SDK version. Use the second version when you compare behavior against the iOS Swift SDK release notes.

For the request body, the upload endpoint, and how to see the request, go to Check what the SDK sent in the iOS Swift SDK.

이 내용이 도움이 되었나요?

For AI agents: a documentation index is available at /docs/llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

이 페이지에서