sentry-react-native: 'RCTEventEmitter.h' file not found while building iOS swift based | React Pod deprecated

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

Output of node -v && npm -v && npm ls --prod --depth=0

v8.9.0
5.5.1

├── react-apollo@2.0.4
├── react-dom@16.2.0
├── react-native@0.51.0
├── react-native-dash@0.0.8
├── react-native-fcm@11.2.0
├── react-native-firebase-crash-report@1.3.0
├── react-native-maps@0.17.1
├── react-native-sentry@0.33.0
├── react-native-svg@5.4.2
├── react-native-vector-icons@4.4.2
├── react-native-version-check@2.0.1
├── react-navigation@1.0.0-beta.13

Config:

Sentry.config('https://...@sentry.io/...', {
....
}).install()

I have following issue:

I’m trying to setup sentry in my react-native project without success.

I’ve already put up an issue in sentry-wizard regarding users that use swift instead of objC because the setup is not done properly when using swift.

But basically, after linking everything and manually add the excerpt of code to AppDelegate.swift I do pod install to get the Sentry libs, but apparently React Pod also comes as a dependency, despite being deprecated. I’m not sure if that’s causing the issue, but after all these steps, while build the project I always get 'RCTEventEmitter.h' file not found in RNSentryEventEmitter.h even though I can navigate to the RCTEventEmitter interface file.

Any help would be appreciated. Thanks in advance.

Steps to reproduce:

  • React Native project using swift for iOS
  • yarn add react-native-sentry
  • react-native link react-native-sentry
  • pod install
  • Manually add missing code to AppDelegate.swift
  • Build Project

Actual result: image

Expected result:

  • Successful build

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 7
  • Comments: 23 (3 by maintainers)

Most upvoted comments

Got it working!

For anyone reading this, these are the steps I took:

  1. Do NOT use CocoaPods for react-native-sentry
  2. Follow the standard install steps: a) yarn react-native-sentry b) react-native link react-native-sentry
  3. If your Podfile was modified by the setup script, remove any reference of ReactNativeSentry
  4. Open Xcode and drag node_modules/react-native-sentry/ios/RNSentry.xcodeproj into your project’s Libraries directory
  5. Open your project’s “Linked Frameworks and Libraries” and add libRNSentry.a

Hope that helps!

@amsul Thanks so much for your post. Was struggling to get Sentry installed and built without errors and NOT using CocoaPods was the way to go.

@amsul’s answer should be in Sentry’s documentation.

i try all way above, it’s still error =))))

@amsul you’re the best!

@amsul You saved my life 😄

Same issue react-native-sentry: ^0.37.1, react-native: 0.51.0

Hey, so I reverted the change, React is back in the podspec. Version 0.37.0 is on its way, sorry for the inconvenience this has caused.

@amsul this is the only thing that finally fixed this header files issue both locally and on our CI. thank you!

@amsul I’ve done that after adding the react-native-sentry ios folder to the headers search path with recursive mode, but still no luck. Am I missing something? 😞

EDIT: I was unnecessarily importing RNSentry in .swift, there’s no need to import, now it works!!