Closed guillaumekh closed 2 years ago
@guillaumekh If you do not have cocoapods, you can do manual linking via: https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#linking-the-native-library
Sounds like we're missing a note that for RN versions below 0.60, cocoapods isn't installed by default with RN. So unless users installed it manually, sentry-wizard won't be able to install things automatically. So the manual linking step that Jenn mentioned above should help in this case.
We'll make sure to add this note ^ to our docs
i have cocoapods installed and have attempted manual linking too, with the same results.
Is there some additional information I can gather which might be helpful in figuring out what's going on?
i have cocoapods 1.11.2, installed with homebrew (brew install
, not brew cask install
). This could be related given how many ways there are to install cocoapods.
I'm looking at the sentry-wizard source, and don't see anything related to cocoapods (just grepping for "pod" here). How does sentry-wizard check for it?
@guillaumekh react-native link @sentry/react-native
is actually what adds the pod to the podfile, looking at the error message you provided:
Unable to find a specification for 'React-Core' depended upon by 'RNSentry'
mind if I can see your whole podfile? Seems like it's missing React-Core
This is starting to make more sense.
I initially had no Podfile, since all my dependencies are installed w/ yarn/npm. I only added a Podfile to satisfy RNSentry's apparent requirement for one. That Podfile only includes the bare minimum:
platform :ios, '9.3'
abstract_target 'allTargets' do
pod 'RNSentry', :podspec => '../node_modules/@sentry/react-native/RNSentry.podspec'
end
@guillaumekh We will fix the docs to link to the manual linking section that cocoapods is actually not required, we didn't link it in the docs at first and used cocoapods as it's included in RN since 0.60.0 and we have since rewrote the docs from scratch.
Anyways, if you choose to continue using cocoapods you will need these other dependencies before RNSentry
:
# React
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTBlob',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
Also, now that you are using cocoapods makesure you open the .xcworkspace
file instead of the .xcodeproj
file.
This is very helpful thanks.
pod install
still fails with the same Unable to find a specification for 'React-Core'
error w/ the following Podfile. Any idea what error might be lingering there?
# Uncomment the next line to define a global platform for your project
platform :ios, '9.3'
abstract_target 'allTargets' do
# Needed for RNSentry because https://github.com/getsentry/sentry-react-native/issues/2013
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTActionSheet',
'RCTAnimation',
'RCTBlob',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket'
]
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
# RNSentry
pod 'RNSentry', :podspec => '../node_modules/@sentry/react-native/RNSentry.podspec'
target 'Martini Dev' do
end
target 'Martini Staging' do
end
target 'Martini Prod' do
end
end
Anyways, if you choose to continue using cocoapods
I was hoping to avoid cocoapods. If there's a sane way out, I would love to know about it — or alternatively, an older version of RNSentry which plays nicer w/ RN<0.60
@guillaumekh I tried your podfile and swapped out the app name for mine and it does not work. Try instead of
abstract_target 'allTargets' do
try
target '<app_name>' do
However, Sentry does not need cocoapods if you do not already use it. It's only a convenience feature as most react native apps should have it installed. Otherwise if you're running into issues and are not familiar with cocoapods it's better you completely remove it and manually link following the guide at https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#linking-the-native-library
I tried your podfile and swapped out the app name for mine and it does not work.
What error are you getting? Wether the pod dependencies are declared in a single abstract_target
or duplicated across multiple target
is neutral. The problem w/ the configuration you recommend is that the React-Core
dependency declared in RNSentry.podspec
cannot be satisfied by the React.podspec pulled by npm/yarn and located in ../node_modules/react-native
. RNSentry.podspec
would need to declare a dependency on React/Core
for that to work.
However, Sentry does not need cocoapods if you do not already use it. It's only a convenience feature as most react native apps should have it installed. Otherwise if you're running into issues and are not familiar with cocoapods it's better you completely remove it and manually link following the guide at https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#linking-the-native-library
As I said, I have tried manual linking, with identical results ('Sentry/Sentry.h' file not found
, because native client is absent).
The RNSentry.xcodeproj has a broken reference to Sentry.xcodeproj, which it expects to find under the path node_modules/@sentry/react-native/ios/Sentry/Sentry.xcodeproj
. Since that Sentry.xcodeproj is not an Xcode Product, it is not going to appear on my filesystem unless it's installed by something or someone.
Do I need to add sentry-cocoa
myself to the Xcode projet, wether manually or w/ Cocoapods? If so, the docs skip that entirely and should probably be updated.
@guillaumekh We removed the manual linking docs as it was our mistake that we removed the reference a while ago and received no reports of it not working. With the React-Core
issue, you should downgrade to version 1.8.2
before we changed the dependency. We will explore options of re-adding support for those prior versions or instead bump our minimum requirement.
@jennmueng should this issue be closed after release then?
We will explore options of re-adding support for those prior versions or instead bump our minimum requirement.
OK
In the mean time…
For whoever still running RN<0.60 who might stumble on this issue, and until this issue this closed:
react-native link @sentry/react-native
or manually linking in Xcode/AndroidStudio. 1.3.8 is when the react-cocoa
submodule was removed and the Sentry.xcodeproj reference was broken.React-Core
to React/Core
@guillaumekh Thank you for bringing everything up and writing the guide! I'll add it to our troubleshooting page and possibly a podfile script that'll handle the React-Core issue.
Environment
How do you use Sentry?
Sentry SaaS (sentry.io)
Which SDK and version?
@sentry/react-native 3.2.12 react-native 0.59.10 Xcode 13.2.1 sentry-wizard 1.2.17 sentry-cli 1.71.0
Steps to Reproduce
We follow instructions outlined at https://docs.sentry.io/platforms/react-native/#install
yarn add @sentry/react-native
yarn run react-native link @sentry/react-native
yarn run sentry-wizard -i reactNative -p ios
cd ios; pod install
Expected Result
Xcode project should build.
Actual Result
Build fails during compilation of
RNSentry.m
w/ error'Sentry/Sentry.h' file not found
.The error makes sense since that file is nowhere to be found either in DerivedData or in the project.
Android project builds fine.
Comment
The problem might be linked to the failed
pod install
, but 2 things make me doubt that:ios/Podfile
file w/pod 'RNSentry', :podspec => '../node_modules/@sentry/react-native/RNSentry.podspec'
and retryingpod install
fails with errorUnable to find a specification for 'React-Core' depended upon by 'RNSentry'
.