Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replay options not visible from Objective-C without @import #4543

Open
bruno-garcia opened this issue Nov 15, 2024 · 14 comments
Open

Replay options not visible from Objective-C without @import #4543

bruno-garcia opened this issue Nov 15, 2024 · 14 comments

Comments

@bruno-garcia
Copy link
Member

bruno-garcia commented Nov 15, 2024

Platform

iOS

Environment

Production

Installed

CocoaPods

Version

Latest React Native one

Xcode Version

not sure

Did it work on previous versions?

No response

Steps to Reproduce

A customer on React Native, tried to enable replay through the native layer directly (they are initializign Sentry native directly).
But they said they couldn't call options.experimental from Objective-C

Are you willing to submit a PR?

No response

@brustolin
Copy link
Contributor

brustolin commented Nov 18, 2024

From native objc code, you need to use @import Sentry; and not #import <Sentry/Sentry.h> to be able to use session replay.

Can you check whether this works for the customer?

@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 3 Nov 18, 2024
@brustolin brustolin moved this from Needs Discussion to Needs Investigation in Mobile & Cross Platform SDK Nov 18, 2024
@barisyild
Copy link

From native objc code, you need to use @import Sentry; and not #import <Sentry/Sentry.h> to be able to use session replay.

Can you check whether this works for the customer?

Unfortunately my project is incompatible with the “-fmodules” and “-fcxx-modules” parameters.

Defining these parameters causes the following error in a header file in my project.

import of C++ module 'std_stdint_h' appears within extern "C" language linkage specification [-Wmodule-import-in-extern-c]

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 26, 2024
@brustolin
Copy link
Contributor

Hello @barisyild
In this case, you will need to create a objc wrapper class to start Sentry and enable “-fmodules” and “-fcxx-modules” only for that file.

@barisyild
Copy link

Hello @barisyild In this case, you will need to create a objc wrapper class to start Sentry and enable “-fmodules” and “-fcxx-modules” only for that file.

Obviously this limits me a lot because I'm using the haxe language and I haven't found a way to do this.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 29, 2024
@brustolin
Copy link
Contributor

Obviously this limits me a lot because I'm using the haxe language and I haven't found a way to do this.

Sorry about that. We will investigate an alternative for this problem.

@brustolin
Copy link
Contributor

@barisyild alongside #import <Sentry/Sentry.h> can you try importing #import <Sentry/Sentry-Swift.h>?

@barisyild
Copy link

@barisyild alongside #import <Sentry/Sentry.h> can you try importing #import <Sentry/Sentry-Swift.h>?

When I import this header, the following error occurs.

Showing Recent Messages
Error: In file included from ./src/sentry/SentryModel.mm:192:

 2531 | @interface SentryUserFeedbackWidgetButtonMegaphoneIconView : UIView

      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ^

/.../Sentry-Dynamic.xcframework/ios-arm64_arm64e/Sentry.framework/Headers/Sentry-Swift.h:2531:62: attempting to use the forward class 'UIView' as superclass of 'SentryUserFeedbackWidgetButtonMegaphoneIconView'

   11 | @class UIView;

      |        ^

In file included from ./src/sentry/SentryModel.mm:192:

/.../Sentry-Dynamic.xcframework/ios-arm64_arm64e/Sentry.framework/Headers/SentryReplayApi.h:11:8: forward declaration of class here

 2538 | @interface SentryUserFeedbackWidgetButtonView : UIView

      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ^

/.../Sentry-Dynamic.xcframework/ios-arm64_arm64e/Sentry.framework/Headers/Sentry-Swift.h:2538:49: attempting to use the forward class 'UIView' as superclass of 'SentryUserFeedbackWidgetButtonView'

   11 | @class UIView;

      |        ^

In file included from ./src/sentry/SentryModel.mm:192:

/.../Sentry-Dynamic.xcframework/ios-arm64_arm64e/Sentry.framework/Headers/SentryReplayApi.h:11:8: forward declaration of class here

 2573 | @property (nonatomic) UIWindowLevel windowLevel;

      |                       ^

/.../Sentry-Dynamic.xcframework/ios-arm64_arm64e/Sentry.framework/Headers/Sentry-Swift.h:2573:23: unknown type name 'UIWindowLevel'

 2577 | @property (nonatomic) NSDirectionalRectEdge location;

      |                       ^

/.../Sentry-Dynamic.xcframework/ios-arm64_arm64e/Sentry.framework/Headers/Sentry-Swift.h:2577:23: unknown type name 'NSDirectionalRectEdge'

 2581 | @property (nonatomic) UIOffset layoutUIOffset;

      |                       ^

/.../Sentry-Dynamic.xcframework/ios-arm64_arm64e/Sentry.framework/Headers/Sentry-Swift.h:2581:23: unknown type name 'UIOffset'

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Nov 30, 2024
@brustolin
Copy link
Contributor

Hello @barisyild, Im working on a fix for this problem, can you try our SDK from this link: https://github.com/getsentry/sentry-cocoa/actions/runs/12086165036/artifacts/2254223229

Inside of it you will find all the versions of our SDK, you can keep using Sentry-Dynamic.xcframework.

@barisyild
Copy link

Hello @barisyild, Im working on a fix for this problem, can you try our SDK from this link: https://github.com/getsentry/sentry-cocoa/actions/runs/12086165036/artifacts/2254223229

Inside of it you will find all the versions of our SDK, you can keep using Sentry-Dynamic.xcframework.

Now it compiles.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 2, 2024
@brustolin
Copy link
Contributor

Now it compiles

Perfect! I believe we can proceed with this solution.

@getsantry getsantry bot removed the status in GitHub Issues with 👀 3 Dec 2, 2024
@brustolin brustolin moved this from Needs Investigation to In Progress in Mobile & Cross Platform SDK Dec 2, 2024
@brustolin
Copy link
Contributor

Hello @barisyild, unfortunately the given solution is not ideal for us, we're trying an alternative.

One question: Are you using cocoapod to add Sentry to your project?

@barisyild
Copy link

barisyild commented Dec 3, 2024

Hello @barisyild, unfortunately the given solution is not ideal for us, we're trying an alternative.

One question: Are you using cocoapod to add Sentry to your project?

I place directly to the folder.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 3, 2024
@brustolin
Copy link
Contributor

Strange, Im not able to reproduce it with the framework with the current release. This one: https://github.com/getsentry/sentry-cocoa/releases/download/8.41.0/Sentry-Dynamic.xcframework.zip

Can you try this?

@barisyild
Copy link

Strange, Im not able to reproduce it with the framework with the current release. This one: https://github.com/getsentry/sentry-cocoa/releases/download/8.41.0/Sentry-Dynamic.xcframework.zip

Can you try this?

Yes, I can reproduce the problem with this version.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Dec 3, 2024
@brustolin brustolin moved this from In Progress to Needs Discussion in Mobile & Cross Platform SDK Dec 3, 2024
@kahest kahest changed the title Replay options not visible from Objective-C Replay options not visible from Objective-C without @import Dec 4, 2024
@kahest kahest moved this from Needs Discussion to Backlog in Mobile & Cross Platform SDK Dec 4, 2024
@getsantry getsantry bot removed the status in GitHub Issues with 👀 3 Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: Backlog
Development

Successfully merging a pull request may close this issue.

4 participants