I am following the React Native official guide(https://reactnative.dev/docs/integration-with-existing-apps) to integrate with an existing ios App and trying to add dependencies in podFile as shown below:
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # needed for debugging
# Add any other subspecs you want to use in your project
]
pod "Yoga", :path => "../node_modules/react-native/ReactCommon/yoga"
My React Native version is 0.68.2
When I do: pod install -repo-update it throws me this error:
[!] CocoaPods could not find compatible versions for pod "React/RCTText":
In Podfile:
React/RCTText (from `../node_modules/react-native`)
None of your spec sources contain a spec satisfying the dependency: `React/RCTText (from `../node_modules/react-native`)`.
You have either:
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
What is going wrong here? Can someone help me understand this issue?
I try for del/install pod and node_module folder but the same issue occurred in xcode
error Could not find the following native modules: RNCMaskedView, RNReanimated, RNScreens. Did you forget to run pod install ?
Make sure these 2 pods are included in your PodFile
pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
Then run pod install --repo-update
I got this working using React-native 0.62
In my case adding
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
solved the problem.
I just updated to RN v0.62 and running app on iOS gives me following error
!] CocoaPods could not find compatible versions for pod "ReactCommon/jscallinvoker":
In snapshot (Podfile.lock):
ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)
In Podfile:
ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)
None of your spec sources contain a spec satisfying the dependency: `ReactCommon/jscallinvoker (from `../node_modules/react-native/ReactCommon`)`.
I deleted all node_modules and did npm i. I also did pod install in iOS directory but the issue persists. I also did pod repo update.
For React native 0.62 version
So I figure it out
Replace following line in your Podfile
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
with
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
Edit:
If you have updated to React Native version 0.63
Delete Podfile.lock from iOS folder.
Do npm i
Open podfile from iOS folder
Delete everything and copy below contents
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native/scripts/react_native_pods'
platform :ios, '10.0'
target 'RNTodo' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'RNTodoTests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'RNTodo-tvOS' do
# Pods for RNTodo-tvOS
target 'RNTodo-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Replace RNTodo with your own project name, cd to iOS folder in the terminal and do pod install and everything should work
Also RN 0.63 has dropped support for iOS 9
I solved this issue (version 0.63) by changing the line in the Podfile from
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
to
pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
I think jscallinvoker version is deprecated try to replacing
jscallinvoker
to
callinvoker
RN 0.63 has dropped support for iOS 9
So in pod file
replace
platform :ios, '9.0'*
platform :ios, '10.0'*
and
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
go to the ios folder in the terminal run
pod install
run react-native run-ios
On Upgrade to React Native 0.63.0
This issue happens to my project after upgrading React Native to version 0.63.0 so for the solution I just remove the Podfile.lock and delete whole the Podfile and add the new content from a fresh install React Native project on the latest version and it means its content should be:
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native/scripts/react_native_pods'
platform :ios, '10.0'
target '[YourProjectName]' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target '[YourProjectName]Tests' do
inherit! :complete
# Pods for testing
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target '[YourProjectName]-tvOS' do
# Pods for [YourProjectName]-tvOS
target '[YourProjectName]-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Note: it is obvious you should replace your project name with [YourProjectName].
After it, run npx pod-install command on the root of your project and everything will back on track.
In case anyone is still having issues with React Native Version 0.63.0 then this worked for me
Updating the callinvoker pod as follows
pod 'React-callinvoker', :path => "#{rnPrefix}/ReactCommon/callinvoker"
In RN 0.63.0 you can remove all RN pods from you podfile and just include the following lines inside the target.
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
Also this line needs to be added after the platform line at the beginning of the podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
After this, delete the Pods directory, Podfile.lock and the workspace file. Then just pod install.
React-Native is now configuring pods dynamically, so you don't need to list each one anymore;
use_react_native!(:path => config["reactNativePath"])
This is what you get from a 63.1 base Podfile:
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'test' do
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
target 'testTests' do
inherit! :complete
end
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
target 'test-tvOS' do
target 'test-tvOSTests' do
inherit! :search_paths
end
end
Making manual adjustments according to https://react-native-community.github.io/upgrade-helper/?from=0.62.2&to=0.63.2 might help.
You will then have to run the command cd ios && pod install.
platform :ios, '11.0'
I solved this issue (version 0.63.4) by changing as below
pod 'ReactCommon/callinvoker', :path => "../node_modules/react-native/ReactCommon"
# Maybe someone is
pod 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon"
↓
pod 'React-callinvoker', :path => "../node_modules/react-native/ReactCommon/callinvoker"
In case you already had callinvoker but you still have an error. This manipulation helped me :
react-native start --reset-cache
rm -rf node_modules/
rm -rf package-lock.json
cd ios
pod deintegrate
cd ..
rm -rf ios/Podfile.lock
npm install
npm audit fix
react-native link
cd ios
pod install
cd ..
react-native run-ios
Faced this issue while upgrading Expo bare workflow 0.38 (RN 0.62) to 0.39 (has RN 0.63). Edited answer of #Pritish did work, But it says this error
[!] Unable to find a target named `RNTodo-tvOS` in project `RNTodo.xcodeproj`, did find `RNTodo`.
And
[!] Unable to find a target named `RNTodoTests` in project `RNTodo.xcodeproj`, did find `RNTodo`.
Got workaround by changing Podfile like below
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
require_relative '../node_modules/#react-native-community/cli-platform-ios/native_modules'
platform :ios, '10.0'
target 'daytodiary' do
use_unimodules!
config = use_native_modules!
use_react_native!(:path => config["reactNativePath"])
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable these next few lines.
use_flipper!
post_install do |installer|
flipper_post_install(installer)
end
end
What changed?
ADD unimodules at top
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
ADD use_unimodules! before config = use_native_modules!.
REMOVE
target '[YourProjectName]Tests' do
inherit! :complete
# Pods for testing
end
REMOVE
target 'RNTodo-tvOS' do
# Pods for RNTodo-tvOS
target 'RNTodo-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
For Android (If you are getting errors after upgrading)
In android/build.gradle
Change
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 28
}
To
ext {
buildToolsVersion = "29.0.2"
minSdkVersion = 21
compileSdkVersion = 29
targetSdkVersion = 29
}
if you have upgraded react native to 0.65+,
you need to do a change in podfile
platform :ios, '10.0'
to
platform :ios, '11.0'
I am hitting a brick wall at the moment trying to get my app to build in VS AppCenter. It's a react-native project, with some dependencies brought in via cocoapods.
Everything builds locally fine (clean clone on clean vm)
In the CI Environment in AppCenter though I get the following errors:
ld: warning: directory not found for option '-L/Users/vsts/Library/Developer/Xcode/DerivedData/projectname-adroxiklvgljuicvfqowylcdxjrt/Build/Intermediates.noindex/ArchiveIntermediates/unisafe/BuildProductsPath/Release-iphoneos/BVLinearGradient'
ld: library not found for -lGoogle-Maps-iOS-Utils
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Archive Failed
I get the first warning a number of times for each pod.
Here is my Podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
project './projectname.xcproj'
target 'projectname' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for projectname
pod 'AppCenter/Push', '~> 1.10.0'
pod 'AppCenter/Crashes', '~> 1.10.0'
pod 'AppCenter/Analytics', '~> 1.10.0'
pod 'AppCenterReactNativeShared'
rn_path = '../node_modules/react-native'
rn_maps_path = '../node_modules/react-native-maps'
pod 'yoga', path: "#{rn_path}/ReactCommon/yoga/yoga.podspec"
pod 'React', path: rn_path, subspecs: [
'ART',
'Core',
'RCTActionSheet',
'RCTAnimation',
'RCTGeolocation',
'RCTImage',
'RCTLinkingIOS',
'RCTNetwork',
'RCTSettings',
'RCTText',
'RCTVibration',
'RCTWebSocket',
]
pod 'react-native-maps', path: rn_maps_path
pod 'react-native-google-maps', path: rn_maps_path # Remove this line if you don't want to support Google Maps on iOS
pod 'GoogleMaps' # Remove this line if you don't want to support Google Maps on iOS
pod 'Google-Maps-iOS-Utils' # Remove this line if you don't want to support GoogleMaps on iOS
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'react-native-background-timer', :path => '../node_modules/react-native-background-timer'
pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
pod 'lottie-ios', :path => '../node_modules/lottie-ios'
pod 'lottie-react-native', :path => '../node_modules/lottie-react-native'
pod 'TouchID', :path => '../node_modules/react-native-touch-id'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
platform :ios, '11.0'
# target 'projectnameTests' do
# inherit! :search_paths
# # Pods for testing
# end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'react-native-google-maps'
target.build_configurations.each do |config|
config.build_settings['CLANG_ENABLE_MODULES'] = 'No'
end
end
if target.name == "React"
target.remove_from_project
end
end
end
In my library search paths i have:
$(inherited)
$(BUILD_DIR)/${CONFIGURATION}$(EFFECTIVE_PLATFORM_NAME)
"${PODS_ROOT}"
Any ideas would be greatly appreciated. Thanks.
Not a perfect solution...but resolved this by removing and re-adding everything under 'Linked Frameworks and Libraries' in XCode build settings.
I'll close this, but if anyone else has this issue, reply here or PM - happy to help.
I'm getting this error when calling Permissions.check() using the react-native-permissions library
I'm using the code straight from the react-native-permissions README
componentWillMount() {
Permissions.check('photo').then(response => {
console.log(response);
});
}
I used react-native link to link it.
react-native link react-native-permissions
I'm pretty sure it's linked correctly because when I call Permissions.getTypes()
componentWillMount() {
console.log(Permissions.getTypes());
}
I get the following response:
React Native Version: 0.53.0
React Native Permissions Version: 1.1.1
Podfile
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
target 'myApp' do
pod 'Stripe', '~> 11.2.0'
pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
pod 'ReactNativePermissions', :path => '../node_modules/react-native-permissions'
end
Edits
I downgraded React Native to 0.52.0 as that's the last react-native-permissions updated their README and I still get the same error.
It turns out,
Permissions.getTypes()
works without linking.
I ended up having to follow the manual linking instructions here: using manual linking
Using manual linking
In the XCode's "Project navigator", right click on your project's Libraries folder ➜ Add Files to <...>
Go to node_modules ➜ react-native-permissions ➜ select ReactNativePermissions.xcodeproj
Add libReactNativePermissions.a to Build Phases -> Link Binary With Libraries