I'm currently using the following packages:
react-native-sentry: 0.14.5
react-native: 0.46.1
I've linked the binary with the sentry library but when i build and try to run my app in the simulator I get the following error: Lexical or Preprocessor Issue: Sentry/Sentry.h file not found - RNSentry.m
I've tried cleaning my project in xcode, nuking my node_modules and reinstalling, but still no avail. Any help would be greatly appreciated!
Go to ios folder and try this:
sudo gem install cocoapods
pod init
pod install
@mciechanowicz thanks for the suggestion! however, i don't use cocoapods in my react-native application and i would not like to introduce it if possible. are there any other alternatives?
Hi @juhaelee, I've tried it with a clean project and it works well.
I suggest you to do some actions:
It may help you.
Yup I did all of those. Still getting the error :(
I am using xcode 8.2.1 and Bitrise CI uses xcode 8.3, On my system the code builds without any errors and On CI it through this same error.
If I download the code from the repository and do a local build using Bitrise cli tools it also fails with the same error. But the same code builds successfully from xcode 8.2.1 editor.
This error is introduced recently, I didn't remember when, earlier CI doesn't have any problem.
I think there is currently a bug in react-native with the link step.
Can you try patching this file locally in you node_modules folder and see if link works?
https://github.com/facebook/react-native/pull/14863
Same error here. It only happens when running on Release build configuration.
"react-native": "^0.45.1"
"react-native-sentry": "^0.13.3"
Hi,
I too am getting this error, but only when archiving a release build (both on our CI server and locally).
Project was successfully linked and the debug configuration compiles / runs perfectly.
Here's the error xcodebuild returns:
▸ Compiling SentryDebugMeta.m
▸ Compiling SentryFileManager.m
▸ Compiling SentryKSCrashReportConverter.m
▸ Compiling SentryBreadcrumbTracker.m
▸ Building library libSentryStatic.a
▸ Building RNSentry/RNSentry [(Release)]
▸ Check Dependencies
❌ /Users/distiller/app_name_omitted/node_modules/react-native-sentry/ios/RNSentry.m:10:9: 'Sentry/Sentry.h' file not found
#import <Sentry/Sentry.h>
Our app is currently using:
react-native: v0.45.1
react-native-sentry: v0.14.6
I've already tried cleaning the project and derived data locally (in Xcode ⇧⌘K to clean, ⌥⇧⌘K to clean build folder and ⌘, to open Settings > Locations > Derived data & delete the folders content).
However this won't affect our CI server as it's fresh every time (caching has been disabled to rule out such issues)
I've also unlinked and re-linked to no avail (including the fix @HazAT suggests).
Thanks for any help.
I got the same error today, I realized that I called react-native link react-native-sentry too often, RNSentry was linked twice. Make sure RNSentry is only linked once.
I will close this issue for since it has become stale, if you are still experiencing this, feel free to post again.
@juhaelee @HazAT still got this problem. any solutions please
We've been having this issue since the beginning. Still happens with 0.35.3. It seems to be triggered by resetting my node_modules and cleaning my xcode project.
The only thing that seems to fix it is re-running react-native link react-native-sentry
This is the only thing that ever gets changes but somehow it fixes it...
project.pbxproj
61B82A57846D4458AAC31964 /* Frameworks */ = {
isa = PBXGroup;
children = (
);
name = Frameworks;
path = Application;
sourceTree = "<group>";
};
@jpaas Do you get that change every time run you react-native link? I do...seems to be an issue with it but I can´t see what the problem is :/
@emilkarl no its not triggered by react-native link. I almost never run that and I've learned to never do it without targeting a specific node module. i.e. react-native link x. Nearest I can figure, it happens sometimes when I delete all my node modules and reinstall. Just guessing, but maybe when the react-native-sentry module changes/upgrades?
I had this issue too and the only thing that solved it was:
$(SRCROOT)/Sentry/Sources (recursive) to the RNSentry's target Header Search Paths#import <Sentry/Sentry.h> with #import "Sentry.h"Here's the diff:
--- a/node_modules/react-native-sentry/ios/RNSentry.m
+++ b/node_modules/react-native-sentry/ios/RNSentry.m
@@ -6,7 +6,7 @@
#import "RCTConvert.h"
#endif
-#import <Sentry/Sentry.h>
+#import "Sentry.h"
NSString *const RNSentryVersionString = @"0.39.0";
NSString *const RNSentrySdkName = @"sentry.javascript.react-native";
--- a/node_modules/react-native-sentry/ios/RNSentry.xcodeproj/project.pbxproj
+++ b/node_modules/react-native-sentry/ios/RNSentry.xcodeproj/project.pbxproj
@@ -314,6 +314,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../react-native/React/**",
+ "$(SRCROOT)/Sentry/Sources/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
@@ -332,6 +333,7 @@
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../../react-native/React/**",
+ "$(SRCROOT)/Sentry/Sources/**",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "-ObjC";
Same problem here, adding the Header Search Path as @igorlira said fixed it.
See my comment in the other thread: https://github.com/getsentry/react-native-sentry/issues/5#issuecomment-468277376
Just replace #import
I`ve tried all solutions in this thread with no success. Using:
@casare me too !
I`ve tried all solutions in this thread with no success. Using:
- RN 0.59.9,
- @sentry/react-native": "^1.3.9" (not react-native-sentry)
- Also noticed that the file Sentry.h does not exists in node_modules/@sentry.
- On Android it worked perfectly.
Any hint?
I'm getting the same error. Works fine on Android, can't make it run on iOS. I've tried using Cocoapods as well, but still stuck. I would love having some help with this
I managed to solve the issue. After a LOT of tries, this it what made it work.
First, these are my settings:
First you have to link the library, you can do it either automatic or manually, as mentioned in the docs. I tried both, but in my last try I did it manually, I guess both approaches are okay.
I was not using Cocoapods, but could not find the way to make it work without it. So I had to initialize it as follows:
cd ios
pod init
Now I had to include the RNSentry pod as mentioned in the docs.
This is how my Podfile looks like:
target 'target_name' do
# Comment the next line if you don't want to use dynamic frameworks
# use_frameworks!
# Pods for target_name
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'React', :path => '../node_modules/react-native/'
pod 'RNSentry', :podspec => '../node_modules/@sentry/react-native/RNSentry.podspec'
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == "React"
target.remove_from_project
end
end
end
Short explanation: besides adding the RNSentry pod, I had to include React as well because it was automatically choosing a very old version of it (0.11.0, if I remember well). I also had to include the yoga pod because I've gotten a similar error of not finding a file as well. And the last part really I have no idea what it does, but I've got a different error and StackOverflow said to add that to solve it, so I did.
ALSO VERY IMPORTANT: you have to comment the use_frameworks line, because that also causes trouble.
After this you just do pod install.
Finally I had to remove the libRNSentry.a file from the Link Binary With Libraries space in Xcode because for some reason that file appears on red in my project, so it mentioned that it could not find the file, so I just removed it.
And voilà, now Sentry works on iOS.
Hope it helps you and saves you all the time that I wasted on this 👍
Most helpful comment
I`ve tried all solutions in this thread with no success. Using:
Any hint?