getsentry / sentry-react-native

Official Sentry SDK for React-Native
https://sentry.io
MIT License
1.55k stars 325 forks source link

Support Sentry React Native for react-native-macos #1813

Open thefinnomenon opened 2 years ago

thefinnomenon commented 2 years ago

Environment

How do you use Sentry? Sentry SaaS (sentry.io)

Which SDK and version? @sentry/react-native 3.1.1

Steps to Reproduce

  1. yarn add @sentry/react-native
  2. npx @sentry/wizard -i reactNative -p ios
  3. pod install
  4. react native macos

Expected Result

The Mac app builds and reports errors to Sentry.

Actual Result

/Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:75:44: error: no known instance method for selector 'applicationState'
    if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive && !sentHybridSdkDidBecomeActive && sentryOptions.enableAutoSessionTracking) {
                                           ^~~~~~~~~~~~~~~~
In module 'AppKit' imported from /Users/finn/Projects/react-native-universal-monorepo/packages/macos/macos/Pods/Headers/Public/React-Core/React/RCTUIKit.h:124:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:137:12: note: receiver is instance of class declared here
@interface NSApplication : NSResponder <NSUserInterfaceValidations, NSMenuItemValidation, NSAccessibilityElement, NSAccessibility>
           ^
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:75:65: error: use of undeclared identifier 'UIApplicationStateActive'
    if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive && !sentHybridSdkDidBecomeActive && sentryOptions.enableAutoSessionTracking) {
                                                                ^
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:75:44: error: no known instance method for selector 'applicationState'
    if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive && !sentHybridSdkDidBecomeActive && sentryOptions.enableAutoSessionTracking) {
                                           ^~~~~~~~~~~~~~~~
In module 'AppKit' imported from /Users/finn/Projects/react-native-universal-monorepo/packages/macos/macos/Pods/Headers/Public/React-Core/React/RCTUIKit.h:124:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:137:12: note: receiver is instance of class declared here
@interface NSApplication : NSResponder <NSUserInterfaceValidations, NSMenuItemValidation, NSAccessibilityElement, NSAccessibility>
           ^
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:179:30: error: property 'isFramesTrackingRunning' not found on object of type 'PrivateSentrySDKOnly'
    if (PrivateSentrySDKOnly.isFramesTrackingRunning) {
                             ^
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:180:59: error: property 'currentScreenFrames' not found on object of type 'PrivateSentrySDKOnly'
        SentryScreenFrames *frames = PrivateSentrySDKOnly.currentScreenFrames;
                                                          ^
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:187:61: error: property 'total' cannot be found in forward class object 'SentryScreenFrames'
            @"totalFrames": [NSNumber numberWithLong:frames.total],
                                                     ~~~~~~ ^
In file included from /Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:9:
In file included from /Users/finn/Projects/react-native-universal-monorepo/packages/macos/macos/Pods/Headers/Private/Sentry/Sentry.h:9:
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/macos/Pods/Headers/Private/Sentry/PrivateSentrySDKOnly.h:5:68: note: forward declaration of class here
@class SentryEnvelope, SentryDebugMeta, SentryAppStartMeasurement, SentryScreenFrames;
                                                                   ^
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:188:62: error: property 'frozen' cannot be found in forward class object 'SentryScreenFrames'
            @"frozenFrames": [NSNumber numberWithLong:frames.frozen],
                                                      ~~~~~~ ^
In file included from /Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:9:
In file included from /Users/finn/Projects/react-native-universal-monorepo/packages/macos/macos/Pods/Headers/Private/Sentry/Sentry.h:9:
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/macos/Pods/Headers/Private/Sentry/PrivateSentrySDKOnly.h:5:68: note: forward declaration of class here
@class SentryEnvelope, SentryDebugMeta, SentryAppStartMeasurement, SentryScreenFrames;
                                                                   ^
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:189:60: error: property 'slow' cannot be found in forward class object 'SentryScreenFrames'
            @"slowFrames": [NSNumber numberWithLong:frames.slow],
                                                    ~~~~~~ ^
In file included from /Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m:9:
In file included from /Users/finn/Projects/react-native-universal-monorepo/packages/macos/macos/Pods/Headers/Private/Sentry/Sentry.h:9:
/Users/finn/Projects/react-native-universal-monorepo/packages/macos/macos/Pods/Headers/Private/Sentry/PrivateSentrySDKOnly.h:5:68: note: forward declaration of class here
@class SentryEnvelope, SentryDebugMeta, SentryAppStartMeasurement, SentryScreenFrames;
                                                                   ^

The following build commands failed:
        CompileC /Users/finn/Library/Developer/Xcode/DerivedData/reactnativeuniversalproject-gykikrnpgrtjeaearbpvhvmvlubz/Build/Intermediates.noindex/Pods.build/Debug/RNSentry-macOS.build/Objects-normal/x86_64/RNSentry.o /Users/finn/Projects/react-native-universal-monorepo/packages/macos/node_modules/@sentry/react-native/ios/RNSentry.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'RNSentry-macOS' from project 'Pods')
(1 failure)
github-actions[bot] commented 2 years ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

marandaneto commented 2 years ago

similar to https://github.com/getsentry/sentry-react-native/issues/1407 RN and Desktop Support

marandaneto commented 2 years ago

@jennmueng just to confirm, we dont support macOS right

roxk commented 2 years ago

@marandaneto Do maintainers intend to at least support enableNative: false scenario? Right now adding RN sentry to the project causes the build to fail. Since I only need to capture errors in js, I can submit a PR adding API availability guard around the offending calls in RNSentry.m just to make it compile in macOS. That should make react-native-macos at least reach feature parity with react-native-windows. Thanks!

marandaneto commented 2 years ago

@roxk We do have the intention in the future if it gets enough traction, but it has not been prioritized yet. PR would be welcomed :)

Context: https://github.com/microsoft/react-native-macos#readme