-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installing wrong React (0.11) while using Podfile #324
Comments
@ohtangza I've just tried this with a brand new project set up in the way we recommend, with React referenced in the Podfile AND linked manually in Xcode, but am not getting the duplicate symbols error that you mention. React is included in the Podfile to prevent other compilation issues that mean you wouldn't necessarily even get this far in the process so we're not in a position to remove it. When you add React to the Podfile, which subspecs do you include? The ones we list, or some additional ones? Xcode is notoriously bad at cleaning projects when things change outside them, e.g. a Pod is added/removed and pod install is run. I would suggest that you:
|
@chrisbianca Oh, in my project, I also added other subspecs which seem to be unnecessary. I'll try with more cleaner setting and keep you updated. Always thanks for your responsiveness :) |
With only React - Core installed, it works without any critical issue now. Don't you have any warning like below?
|
Same here. I don't want to install React using Cocoapods. It is not suited for a react-native project (double references!), only for hybrid projects including some react-native views (http://facebook.github.io/react-native/releases/0.47/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies) The best way to install a react-native library should be: In a react-native projectplatform :ios, '8.0'
target 'app' do
pod 'Firebase/Core'
# Optional Firebase libs
pod 'Firebase/Auth'
# ...
end AND a In a non react-native projectplatform :ios, '8.0'
target 'app' do
pod 'Yoga', :path => '../../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
pod 'React', path: '../../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'BatchedBridge'
]
pod 'RNFirebase', :path => '../node_modules/react-native-firebase'
pod 'Firebase/Core'
# Optional Firebase libs
pod 'Firebase/Auth'
# ...
end So, to make this library install work correctly, it will be needed to:
|
I made a pull request to start solving this problem. |
@zoontek react-native link is not flexible enough for our needs across both iOS and Android which is why we aren't using it. Due to the way that Firebase is broken down into modules and the fact we want to support the same approach, a manual setup is favourable and causes less issues. Fixing Trust me, we take the setup of the library very seriously and have experimented with each of the different approaches, but our current approach is by far the most reliable we have found so far. We will take another look at this, but in the meantime we cannot remove the React podspec dependency as this fixes other issues that were present without the library being there. As an aside, Cocoapods is perfectly suited to a React Native project - I am using it for both my large scale RN apps as I have found it far more reliable than react-native link, albeit with a bit more manual setup. Why Facebook didn't build RN around Cocoapods on the iOS side I have no idea. |
@chrisbianca So can you please update the documentation to avoid the double React compilation? It's currently a serious problem. |
@zoontek I'm confused. If you follow the instructions then there is no double React compilation problem. The issue here came because subspecs that weren't listed in our instructions were added? |
My current setup is the following. source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.2'
target 'mobile' do
pod 'Yoga', :path => '../node_modules/react-native/ReactCommon/yoga/Yoga.podspec'
pod 'React', path: '../node_modules/react-native', :subspecs => [
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
'BatchedBridge'
]
# ...
pod 'RNFirebase', :path => '../node_modules/react-native-firebase'
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
end |
@zoontek Which is not the setup we recommend. You can do one of 2 things:
|
@chrisbianca I finally success to make it worked. I 1) just include the Core and BatchedBridge subspecs in the Podfile, remove the other, but keep the linked libraries within XCode 2) Remove libReact.a from Linked Frameworks and Librairies\ EDIT: It still doesn't work on my iPhone, only on the simulator. (dual instance :( ) |
Dual instance where exactly? As an aside, I have submitted a PR to React Native to hopefully allow us to use However, based on previous records, this might not land in React Native for quite a while |
My bad, it was due to something else (I had two dev menus). I close the PR :) |
@chrisbianca I think there is no critical issue for now. I cleaned everything again and then left only two libraries required for this library. With React installed on my Xcode project and Pod Project, it works well now. Thanks for your response! |
With this dependency present, people cannot install this using Cocoapods. It attempts to install React 0.11.0. Adding a pod line for React in the podfile is not a good idea for people who started their projects with `react-native init` because you'll get double references to the same files. See the following issues: invertase/react-native-firebase#324
I am not using React with Pod. When I tried to run
pod install
, it automatically installs React (0.11) as the screenshot below says.If I include the React within Podfile, it shows an error during the archiving process. During development, it does not output the error even if I install the React twice in my project file and Podfile.
Do you think we can remove
React
dependency in podspec (https://github.com/invertase/react-native-firebase/blob/master/RNFirebase.podspec)? I was searching if I could conditionally exclude the React dependency to be installed., but had no luck. If it's okay, I might make a pull request for it.Environment
The text was updated successfully, but these errors were encountered: