question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support Sentry React Native for react-native-macos

See original GitHub issue

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)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
roxkcommented, Feb 22, 2022

@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!

0reactions
marandanetocommented, Feb 22, 2022

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native
Sentry's React Native SDK enables automatic reporting of errors and exceptions, and identifies performance issues in your application. The React Native SDK ...
Read more >
sentry capture network body failed request
I tried to use the http version of the API but the error still appears. Now, This is my package.json. dependencies": { "@react-native-community/async-storage": ......
Read more >
Plugins Overview
Npm: https://www.npmjs.com/package/@sentry/react-native. Installation: ... Version: github:CHaNGeTe/react-native-airplay-ios#feature/cocoapods-support.
Read more >
sentry/react-native
Bad software is everywhere, and we're tired of it. Sentry is on a mission to help developers write better software faster, ...
Read more >
React Native Directory
An interactive directory to find packages for your React Native apps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found