Podfile - specify sub dependency version - react-native

Is there a way to force a sub dependency version for a Pod dependency? I have this Pod dependency;
Podfile
...
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
It has a subdependncy on boost-for-react-native without specifying a version which results in 1.57.0 being installed.
Podfile.lock
...
- Folly (2016.09.26.00):
- boost-for-react-native
I need version 1.63.0. If I specify that in the parent Podfile I still end up with 1.57.0.
Podfile
...
pod 'boost-for-react-native', '~> 1.63.0'
I believe I need to specify it on the Folly file itself.

Related

'React/RCTDevSettings.h' file not found

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.

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 Native 0.57 + CocoaPods - Failure to locate linked libraries only in CI Environment

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.

XCode 9.1 Command /bin/sh failed with exit code 1

After updating xcode to version 9.1, I can't compile my projects, always have the same error Command /bin/sh failed with exit code 1. I tried to create empty project, install all pods I need, and the result is the same. Here is my podfile
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!
target 'xcode9.1' do
pod 'RMStore'
pod 'GoogleMaps'
pod 'RMMapper'
pod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
pod 'VK-ios-sdk'
pod 'TwitterKit'
pod 'GoogleSignIn'
pod 'Flurry-iOS-SDK/FlurrySDK'
pod 'TWSReleaseNotesView'
pod 'GoogleAnalytics'
pod 'GoogleTagManager','~> 3.15.0'
pod 'SBJson'
pod 'Fabric'
pod 'Crashlytics'
pod 'APOfflineReverseGeocoding'
pod 'AFNetworking'
pod 'Realm'
end
This problem repeats in all my projects, can anybody explain me how to fix it?
Here is the screen of full error
The solution is very simple. In your pods target, Build settings, I changed valid architectures list. Also Build architectures only flag change to No can resolve the problem.

Cocoapods: Making a Cocoapod - Importing Alamofire and other Libraries

I'm trying to create a Cocoapod. The files inside the library need access to Alamofire, SwiftyJSON, and XCGLogger Pods.
I have tried two approaches and they are both failing:
(1) Inside the Example project, I edited my Podfile to include:
pod 'couchbase-lite-ios'
pod 'SwiftyJSON', '~> 2.2.0'
pod 'Alamofire', '~> 1.2'
pod 'XCGLogger', '~> 2.0'
Did pod update relaunched the Example Workspace. Added files to the 'Development Pods' that use Alamofire, SwiftyJSON, XCGLogger, and Couchase, but I'm getting an error, no such module found.
(2) I started a new project through pod lib create and this time I manually dragged the frameworks mentioned above in Xcode, and still get the error no such module found.
Again, the files inside the Pods (or Library) that I'm trying to create can't seem to access Alamofire, SwiftyJSON, XCGLogger, and Couchase dependency. What am I doing wrong?
Add the dependency to your *.podspec file.
Pod::Spec.new do |s|
...
s.dependency 'Alamofire'
s.dependency 'SwiftyJSON'
s.dependency 'XCGLogger'
s.dependency 'couchbase-lite-ios'
...
end