2

Installed with yarn install react-native-unimodules

The next step in the instructions required me to edit my project Podfile. The necessary additions were shown here.

Here is my resultant Podfile

platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
target 'MyProjectName' do
  # Pods for MyProjectName
  pod 'React', :path => '../node_modules/react-native/', :subspecs => [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket',
    'RCTAnimation',
    'RCTImage',
  ]
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  use_unimodules!

  target 'MyProjectNameTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'MyProjectName-tvOS' do
  # Pods for MyProjectName-tvOS

  target 'MyProjectName-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

The next step is running pod install, which gives the following output/error:

$ pod install
Installing unimodules:
 expo-app-loader-provider@5.0.1 from ../node_modules/expo-app-loader-provider/ios
 expo-constants@5.0.1 from ../node_modules/expo-constants/ios
 expo-file-system@5.0.1 from ../node_modules/expo-file-system/ios
 expo-permissions@5.0.1 from ../node_modules/expo-permissions/ios
 unimodules-barcode-scanner-interface@2.0.1 from ../node_modules/unimodules-barcode-scanner-interface/ios
 unimodules-camera-interface@2.0.1 from ../node_modules/unimodules-camera-interface/ios
 unimodules-constants-interface@2.0.1 from ../node_modules/unimodules-constants-interface/ios
 unimodules-core@2.0.1 from ../node_modules/@unimodules/core/ios
 unimodules-face-detector-interface@2.0.1 from ../node_modules/unimodules-face-detector-interface/ios
 unimodules-file-system-interface@2.0.1 from ../node_modules/unimodules-file-system-interface/ios
 unimodules-font-interface@2.0.1 from ../node_modules/unimodules-font-interface/ios
 unimodules-image-loader-interface@2.0.1 from ../node_modules/unimodules-image-loader-interface/ios
 unimodules-permissions-interface@2.0.1 from ../node_modules/unimodules-permissions-interface/ios
 unimodules-react-native-adapter@2.0.1 from ../node_modules/@unimodules/react-native-adapter/ios
 unimodules-sensors-interface@2.0.1 from ../node_modules/unimodules-sensors-interface/ios
 unimodules-task-manager-interface@2.0.1 from ../node_modules/unimodules-task-manager-interface/ios

Analyzing dependencies
Fetching podspec for `EXAppLoaderProvider` from `../node_modules/expo-app-loader-provider/ios`
Fetching podspec for `EXConstants` from `../node_modules/expo-constants/ios`
Fetching podspec for `EXFileSystem` from `../node_modules/expo-file-system/ios`
Fetching podspec for `EXPermissions` from `../node_modules/expo-permissions/ios`
Fetching podspec for `React-Core` from `../node_modules/react-native/React`
Fetching podspec for `React-DevSupport` from `../node_modules/react-native/React`
Fetching podspec for `React-RCTActionSheet` from `../node_modules/react-native/Libraries/ActionSheetIOS`
Fetching podspec for `React-RCTAnimation` from `../node_modules/react-native/Libraries/NativeAnimation`
Fetching podspec for `React-RCTBlob` from `../node_modules/react-native/Libraries/Blob`
Fetching podspec for `React-RCTImage` from `../node_modules/react-native/Libraries/Image`
Fetching podspec for `React-RCTLinking` from `../node_modules/react-native/Libraries/LinkingIOS`
Fetching podspec for `React-RCTNetwork` from `../node_modules/react-native/Libraries/Network`
Fetching podspec for `React-RCTSettings` from `../node_modules/react-native/Libraries/Settings`
Fetching podspec for `React-RCTText` from `../node_modules/react-native/Libraries/Text`
Fetching podspec for `React-RCTVibration` from `../node_modules/react-native/Libraries/Vibration`
Fetching podspec for `React-RCTWebSocket` from `../node_modules/react-native/Libraries/WebSocket`
Fetching podspec for `React-cxxreact` from `../node_modules/react-native/ReactCommon/cxxreact`
Fetching podspec for `React-fishhook` from `../node_modules/react-native/Libraries/fishhook`
Fetching podspec for `React-jsi` from `../node_modules/react-native/ReactCommon/jsi`
Fetching podspec for `React-jsiexecutor` from `../node_modules/react-native/ReactCommon/jsiexecutor`
Fetching podspec for `React-jsinspector` from `../node_modules/react-native/ReactCommon/jsinspector`
Fetching podspec for `React` from `../node_modules/react-native/`
Fetching podspec for `UMBarCodeScannerInterface` from `../node_modules/unimodules-barcode-scanner-interface/ios`
Fetching podspec for `UMCameraInterface` from `../node_modules/unimodules-camera-interface/ios`
Fetching podspec for `UMConstantsInterface` from `../node_modules/unimodules-constants-interface/ios`
Fetching podspec for `UMCore` from `../node_modules/@unimodules/core/ios`
Fetching podspec for `UMFaceDetectorInterface` from `../node_modules/unimodules-face-detector-interface/ios`
Fetching podspec for `UMFileSystemInterface` from `../node_modules/unimodules-file-system-interface/ios`
Fetching podspec for `UMFontInterface` from `../node_modules/unimodules-font-interface/ios`
Fetching podspec for `UMImageLoaderInterface` from `../node_modules/unimodules-image-loader-interface/ios`
Fetching podspec for `UMPermissionsInterface` from `../node_modules/unimodules-permissions-interface/ios`
Fetching podspec for `UMReactNativeAdapter` from `../node_modules/@unimodules/react-native-adapter/ios`
Fetching podspec for `UMSensorsInterface` from `../node_modules/unimodules-sensors-interface/ios`
Fetching podspec for `UMTaskManagerInterface` from `../node_modules/unimodules-task-manager-interface/ios`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
[!] CocoaPods could not find compatible versions for pod "React/Core":
  In Podfile:
    React/Core (from `../node_modules/react-native/`)

None of your spec sources contain a spec satisfying the dependency: `React/Core (from `../node_modules/react-native/`)`.

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.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

Following the responses to a Github issue regarding this exact error output, I did a search of file contents for my entire project directory and did not get a hit for any place React-Core may be badly defined as React/Core.

This is my first time ever editing a Podfile, and I fear I may have fumbled something in the syntax.

Will
  • 476
  • 1
  • 8
  • 19
  • Why is the phrase `use_native_modules!` added? – hong developer Jul 26 '19 at 04:59
  • That was already there when I opened the `Podfile`. As I said, it was my first time ever editing it so I only added content as described at the gist the install instructions linked. I noticed theirs did not have that line (nor the `require_relative` directive for the `......native_modules` at the top of the Podfile. I don't know the implications of running `pod install` after removing either line, and I feared I'd cause more problems by doing that. – Will Jul 26 '19 at 07:19

2 Answers2

6

React Native changed a lot of things in 0.60, one of them was to split React podspec into separate podspecs.

That means that React podspec no longer has any subspecs. The error you're getting is React/Core, which used to be a subspec, is no longer available (it's now imported separately). To fix the problem, remove the subspecs from your Podfile:

pod 'React', :path => '../node_modules/react-native/'
pod 'React-Core', :path => '../node_modules/react-native/React'
etc...

Note that many tutorials and documentation you'll find on the web include the subspecs definitions. That's how things were done in React Native <=0.59, and are no longer valid in 0.60.

Petr Bela
  • 8,493
  • 2
  • 33
  • 37
  • because of this, in Xcode `Build Phases` > `Link Binary with Libraries` has no React libraries added by default. and when I add a library, I will get an error `React/RCTBridgeModule.h file not found` and I couldn't link `libReact.a` since it's nowhere to be found because of separate podspecs. do you have any idea about this? – Compaq LE2202x Sep 22 '19 at 00:29
  • 1
    @CompaqLE2202x `Link Binary with Libraries` is not being used anymore. The library you're adding should have a podspec file, then you can add it using something like `pod 'RNMyLibrary', :path => '../node_modules/react-native-my-library/ios'`. Most libraries have supported this for months (way before 0.60). If yours doesn't, you should raise an issue with the library creator. – Petr Bela Sep 25 '19 at 15:43
1

I guess podspec names changed: React-Core is not in sub folder it is in root folder. Here is my working pod file with React-Native 0.61.3:

# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'

require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'MyApp' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for MyApp

  pod 'RNDeviceInfo',         :path => '../node_modules/react-native-device-info'
  pod 'FBLazyVector',         :path => "../node_modules/react-native/Libraries/FBLazyVector"
  pod 'RCTRequired',          :path => "../node_modules/react-native/Libraries/RCTRequired"
  pod 'RCTTypeSafety',        :path => "../node_modules/react-native/Libraries/TypeSafety"
  pod 'FBReactNativeSpec',    :path => "../node_modules/react-native/Libraries/FBReactNativeSpec"
  pod 'React-RCTVibration',   :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTSettings',    :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText',        :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTLinking',     :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTImage',       :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTNetwork',     :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation',   :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob',        :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-cxxreact',       :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi',            :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor',    :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector',    :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'React-CoreModules',    :path => '../node_modules/react-native/React/CoreModules'
  pod 'ReactCommon',          :path => '../node_modules/react-native/ReactCommon'
  pod 'React-Core',           :path => '../node_modules/react-native'
  pod 'React',                :path => '../node_modules/react-native'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog',             :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly',            :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'

  target 'MyAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

end
Olcay Ertaş
  • 5,987
  • 8
  • 76
  • 112