DataDog / dd-sdk-ios

Datadog SDK for iOS - Swift and Objective-C.
Apache License 2.0
198 stars 124 forks source link

SPM Tuist PLCrashReporterError #1082

Closed Sakhanko-Pavel closed 1 year ago

Sakhanko-Pavel commented 1 year ago

The issue

issue: PLCrashReporterNSError.h:39:59 Unknown type name 'PLCrashReporterError'

📝 Give us the error message you receive, describe the problem, and answer the questions.

Hi! I'm trying to add DatadogCrashReporting via Tuis and SPM to the Xcode project. Datadog only worked as expected.

Project setup:

import DatadogCrashReporting

.enableCrashReporting(using: DDCrashReportingPlugin())

Tuist & SPM setup:

public static var datadog: TargetDependencies {
    [ .external(name: "DatadogCrashReporting") ]
}

and

public static let datadog = package(
    url: "https://github.com/DataDog/dd-sdk-ios.git",
    .upToNextMajor(from: "1.13.0")
)

Error:

Unknown type name 'PLCrashReporterError' Use of undeclared identifier 'PLCrashReporterErrorOperatingSystem'

If I'm using this config:

Tuist & SPM setup:

public static var datadog: TargetDependencies {
    [
     .external(name: "Datadog"),
     .external(name: "DatadogCrashReporting")
    ]
}

Error:

Typedef redefinition with different types ('enum PLCrashReportTextFormat' vs 'enum PLCrashReportTextFormat')

described here https://github.com/tuist/tuist/issues/4901

Datadog SDK version:

1.13.0

Dependency Manager:

Tuist + SPM

Xcode version:

14.1

Swift version:

5.7

macOS version:

Ventura 13.0.1

Could you please help?

Thanks in advance!

maxep commented 1 year ago

Hello @Sakhanko-Pavel 👋

Can you try to link only DatadogCrashReporting, something like this in your Tuist configuration:

public static var datadog: TargetDependencies {
  [
    .external(name: "DatadogCrashReporting")
  ]
}

The reason is that DatadogCrashReporting already contain Datadog, that's why you get duplicated symbols.

Sakhanko-Pavel commented 1 year ago

Hello @Sakhanko-Pavel 👋

Can you try to link only DatadogCrashReporting, something like this in your Tuist configuration:

public static var datadog: TargetDependencies {
  [
    .external(name: "DatadogCrashReporting")
  ]
}

The reason is that DatadogCrashReporting already contain Datadog, that's why you get duplicated symbols.

yes, the first case described this approach Error:

Unknown type name 'PLCrashReporterError' Use of undeclared identifier 'PLCrashReporterErrorOperatingSystem'

maxep commented 1 year ago

Ah sorry! I've updated the description so the snippets are a bit more readable 👍

I see from https://github.com/tuist/tuist/issues/4901 that you have working native project without Tuist, so I believe the issue is from the Tuist configuration, and not the Datadog SDK itself, is it?

Sakhanko-Pavel commented 1 year ago

Ah sorry! I've updated the description so the snippets are a bit more readable 👍

I see from tuist/tuist#4901 that you have working native project without Tuist, so I believe the issue is from the Tuist configuration, and not the Datadog SDK itself, is it?

Yes, looks like the issue is on their side. I'm just trying to resolve and understand the reason for this behavior. Thank you, @maxep !

maxep commented 1 year ago

Thanks, @Sakhanko-Pavel ! In this case, I will close this issue as we use these tickets to track down issue from the SDK itself. Feel free to add any comment if you happen to resolve on the Tuist side, it might help others.