getsentry / sentry-cocoa

The official Sentry SDK for iOS, tvOS, macOS, watchOS.
https://sentry.io/for/cocoa/
MIT License
803 stars 316 forks source link

Build Error: Use of undeclared identifier 'SentryLog' #4339

Open sof9816 opened 2 weeks ago

sof9816 commented 2 weeks ago

Platform

iOS

Environment

Develop

Installed

CocoaPods

Version

8.36.0

Xcode Version

16.0

Did it work on previous versions?

Yes

Steps to Reproduce

  1. Put Sentry Pods
  2. Pod Install
  3. Run Project Boom, not working

Expected Result

  1. Put Sentry Pods
  2. Pod Install
  3. Run Project Boom, working

Actual Result

Image Image Image

Are you willing to submit a PR?

No,

brustolin commented 2 weeks ago

Hello @sof9816, thanks for reaching out. I couldn't reproduce this issue.

Does this also happen to you when you start a new project and add Sentry? If so, can you send us the test project?

leandrofavarin commented 2 weeks ago

I manage to reproduce this twice:

1- New Xcode 16 project, adding https://github.com/getsentry/sentry-cocoa.git as dependency and all its 3 modules: (regular, dynamic, and swiftui).

2- With your Kotlin Multiplatform dependency (https://github.com/getsentry/sentry-kotlin-multiplatform). Again, with Xcode 16, and importing it as the docs say through Cocoapods Gradle plugin.

brustolin commented 2 weeks ago

Thank you very much for your response, I believe the problem is because you added all the targets.

If I got it right you're using SPM for method number 1. Sentry and Sentry-Dynamic cannot be used together. They are the same SDK with different linking.

Can you try adding just one of this two.

leandrofavarin commented 2 weeks ago

That works surely. However, that's not what's blocking me from using Xcode 16, as I mentioned merely as an example. My main issue is the example #2, with Kotlin Multiplatform. I am not sure if that would mean two different fixes -- if so, I'm happy to create a new issue on its repo.

brustolin commented 2 weeks ago

I'm happy to create a new issue on its repo.

No need to, we can keep track of it in here.

@buenaflor Had you tried Xcode 16 already? Can you help us with this issue?

buenaflor commented 2 weeks ago

I haven't tried xcode 16 yet, I'll have a look

buenaflor commented 2 weeks ago

I'll try to get to this issue asap, I'm out for droidcon new york and the hotel internet is painfully slow for updating my mac and xcode..

kahest commented 2 weeks ago

This seems related: https://github.com/getsentry/sentry-react-native/issues/4095#issuecomment-2357747042

@sof9816 @leandrofavarin can you verify if adding this fixes the issue for you?

    target.build_configurations.each do |config|
      if target.name != "Sentry"
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
      end
    end
carloscuba commented 2 weeks ago

@kahest, after applying the changes in the Podfile, still getting the Use of undeclared identifier 'SentryLog' error

kahest commented 2 weeks ago

@carloscuba thanks for testing and reporting back 🙏

buenaflor commented 2 weeks ago

which Kotlin version are you using for KMP?

https://youtrack.jetbrains.com/issue/KT-71287 this may be related

especially Most usually the issues are related to Kotlin/Native vendored and user-specified cinterops

and We support for Xcode 16 in 2.1.0 just quickly going through different threads, this issue might not necessarily be tied to Kotlin 2.1.0 (which is not out yet btw)

leandrofavarin commented 2 weeks ago

@sof9816 @leandrofavarin can you verify if adding this fixes the issue for you?

Sadly it didn't change the result, and it seems like I got another error from this change:

Cannot find protocol declaration for 'SentryMXManagerDelegate'
• In file included from /~/MyPro/Pods/Sentry/Sources/Sentry/SentryMetricKitIntegration.m:1:

which Kotlin version are you using for KMP?

The latest 2.0.20, haven't tried the upcoming 2.0.21-RC with the fix yet.

buenaflor commented 2 weeks ago

@leandrofavarin could you try 2.1.0-Beta1

leandrofavarin commented 2 weeks ago

@leandrofavarin could you try 2.1.0-Beta1

EDIT: I still get the same error (Use of undeclared identifier 'SentryLog')

buenaflor commented 2 weeks ago

For testing, in Kotlin 2.0.20 can you compile your app with only using

cocopoads {
  // add sentry-cocoa
}

without the KMP dependency implementation("io.sentry...")

I want to find out if it is the KMP dependency that's breaking things or the cinterop through the cocoapods plugin

leandrofavarin commented 2 weeks ago

It still fails without the KMP dependency. To try that, I basically reverted to not using KMP and split the configuration from being on commonMain, to only on iosMain.

Kotlin v2.1.0-Beta1, Sentry 8.36.0 with extraOpts = listOf("-compiler-option", "-fmodules")

buenaflor commented 1 week ago

In that case I believe we unfortunately have to wait.

See this issue, their target versions to support xcode 16 is 2.0.21 or 2.1.0-Beta2