Unable to find a specification for `React-Core` - react-native

trying to install "react-native-camera" to my project.
I'm following those steps: https://github.com/react-native-camera/react-native-camera/blob/master/docs/installation.md#requirements
But at "Additional installation steps" when I use "pod install" It returns;
[!] Unable to find a specification for `React-Core` depended upon by `react-native-camera/BarcodeDetectorMLKit`
You have either:
* out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
* mistyped the name or version.
* not added the source repo that hosts the Podspec to your Podfile.
My Podfile below:
# Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
target 'blabla' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
pod 'react-native-camera', path: '../node_modules/react-native-camera', subspecs: [
'BarcodeDetectorMLKit'
]
# Pods for blabla
target 'blablaTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'blabla-tvOS' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for blabla-tvOS
target 'blabla-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
React native version is 62.0.
React-native-camera version is 3.40.0
What could be problem?

add manually to your Podfile the pod missing:
pod 'React-Core', :path => '../node_modules/react-native/React'

Related

React-Native (0.64.1) & Notification Extension

I am trying to integrate a Notification Extension in my react-native app using the Batch SDK. However I have the following error:
‘sharedApplication' is unavailable: not available on iOS (App Extension) - Use view controller based solutions where appropriate instead.
Here is my pod file:
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'
abstract_target 'BrandName' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications"
target 'BrandNameApp' do
#Production-specific pods
target 'BrandNameAppTests' do
inherit! :complete
# Pods for testing
end
end
target 'BrandNameAppDevelopment' do
#Development-specific pods
end
target 'BrandNameAppStage' do
#Stage-specific pods
end
target 'RichNotificationsExtension' do
#Extension-specific pods
pod 'BatchExtension-ObjC'
end
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
use_flipper!()
post_install do |installer|
react_native_post_install(installer)
end
end
If I try to put my target 'RichNotificationsExtension', else where in my podfile, the module will not be found by the extension file.
I have try to set the "Require Only App-extension-safe API" to "NO" as I have seen in some answers but Xcode won't allow me to build anymore and if I force it in my pod file, the module will not be found either.
Does anyone have a functioning podfile in react-native working with an extension ?
Thanks in advance

React Native 0.63 generated podfile [!] The Podfile does not contain any dependencies

I have built an app which is working on android fine. I have now got a MacBook Pro (M1) and am trying to build my RN app to iOS.
I ran sudo gem install cocoapods
I installed the packages at the root using npm install
cd ios
pod init
here is my podfile
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'caffeind' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for caffeind
target 'caffeindTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'caffeind-tvOS' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for caffeind-tvOS
target 'caffeind-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
as you can see there are no pods where I expected more, so when I run pod install i receive the message and rightly so...
Pod installation complete! There are 0 dependencies from the Podfile and 0 total pods installed.
[!] The Podfile does not contain any dependencies.
however when I then go to build in my Xcode using caffeind.xcworkspace file, I receive the error
'React/RCTBridgeDelegate.h' file not found
there is some helpful advice here - https://github.com/facebook/react-native/issues/25838 but...
I cannot add React to the schemes and I do not see it in my Libraries folder in my project navigator. As the above error seems to be linked to the cocoapods dependency, I believe these issues are linked and whenever I try to manually add React pods to the podfiles there is always another dependency or pod that it needs.
This is my xCode directory
caffeind
caffeind
Libraries - empty
Products
Frameworks
Resources
Pods
pods
-etc
versions:
React Native - 0.63.2
React Native cli - 4.14.0
Ruby - 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
Cocoapods - 1.10.1
Xcode - 12.4
MacBook Pro - Big Sur - 11.2.3 - M1

CocoaPods could not find compatible versions for pod "ReactCommon/jscallinvoker":

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'

React missing in Product (Edit Scheme) after react-native upgrad

After upgrade to latest react-native Product -> Edit scheme is missing in Xcode.
My Podfile is like below
#Uncomment the next line to define a global platform for your project
platform :ios, '9.0'
pod 'Fabric'
pod 'Crashlytics'
target 'Helloworld' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for Helloworld
target 'Helloworld-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'HelloworldTests' do
inherit! :search_paths
# Pods for testing
end
end

How to Add a "Target" to a pod file? (such as HockeyApp)

I'm reading React Native Cookbook by Crysfel Villa, Stan Bershadskiy
I'm at a chapter on using hockeyapp and not sure how to setup the podfile. These are the directions:
How to do it...
First we need to install the react-native-hockeyapp
module in our application. Open the Terminal, go to your application's
root project directory and enter the following command: $ npm install
react-native-hockeyapp --save Go into your ios/ directory and
initialize your Podfile: $ pod init Open your Podfile and add pod
"HockeySDK" to your target. Back in the Terminal, install the Podfile:
$ pod install
I am not 100% sure about "add pod HockeySDK to your target"
My podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'MyApp' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for MyApp
target 'MyApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'MyAppTests' do
inherit! :search_paths
# Pods for testing
end
end
target 'MyApp-tvOS' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
# Pods for MyApp-tvOS
target 'MyApp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
end
Any idea on how to modify the pod file correctly here?
If you want to include HockeySDK module in MyApp target (which is the app that you are builidng) you just need to add pod 'HockeySDK' line like this:
target 'MyApp' do
(...)
pod 'HokeySDK'
(...)
end
Then after running pod install open .xcworkspace file instead of .xcproj. You can find more information in official CocoaPods guide.