Skip to content

Instantly share code, notes, and snippets.

@sjchmiela
Created March 12, 2019 12:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sjchmiela/6c079f2173938a9a61a7c6f053c45000 to your computer and use it in GitHub Desktop.
Save sjchmiela/6c079f2173938a9a61a7c6f053c45000 to your computer and use it in GitHub Desktop.
platform :ios, '10.0'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
# don't just copy and paste this, notice that the target names should align with what is already in your Podfile
target 'YourAppNameHere' do
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge',
'DevSupport',
'RCTText',
'RCTNetwork',
'RCTWebSocket',
'RCTAnimation',
'RCTImage',
]
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 'YourAppNameHereTests' do
inherit! :search_paths
end
end
@manujbahl
Copy link

I just moved to this new module structure and my build is failing.
pod install errors out

Ignoring ffi-1.9.18 because its extensions are not built. Try: gem pristine ffi --version 1.9.18
Ignoring unf_ext-0.0.7.5 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.5
Installing unimodules:
expo-constants@4.0.0 from ../node_modules/expo-constants/ios
expo-file-system@4.0.0 from ../node_modules/expo-file-system/ios
expo-permissions@4.0.0 from ../node_modules/expo-permissions/ios
unimodules-barcode-scanner-interface@1.0.0 from ../node_modules/unimodules-barcode-scanner-interface/ios
unimodules-camera-interface@1.0.0 from ../node_modules/unimodules-camera-interface/ios
unimodules-constants-interface@1.0.0 from ../node_modules/unimodules-constants-interface/ios
unimodules-core@1.0.0 from ../node_modules/@unimodules/core/ios
unimodules-face-detector-interface@1.0.0 from ../node_modules/unimodules-face-detector-interface/ios
unimodules-file-system-interface@1.0.0 from ../node_modules/unimodules-file-system-interface/ios
unimodules-font-interface@1.0.0 from ../node_modules/unimodules-font-interface/ios
unimodules-image-loader-interface@1.0.0 from ../node_modules/unimodules-image-loader-interface/ios
unimodules-permissions-interface@1.0.0 from ../node_modules/unimodules-permissions-interface/ios
unimodules-react-native-adapter@1.0.0 from ../node_modules/@unimodules/react-native-adapter/ios
unimodules-sensors-interface@1.0.0 from ../node_modules/unimodules-sensors-interface/ios
unimodules-task-manager-interface@1.0.0 from ../node_modules/unimodules-task-manager-interface/ios

Analyzing dependencies
Fetching podspec for DoubleConversion from ../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Fetching podspec for EXConstants from ../node_modules/expo-constants/ios
[!] The EXConstants pod failed to validate due to 2 errors:
- ERROR | attributes: Missing required attribute authors.
- WARN | attributes: Missing required attribute license.
- ERROR | attributes: Missing required attribute homepage.
- WARN | license: Missing license type.
- WARN | source: Git sources should specify a tag.
- WARN | description: The description is equal to the summary.

@sudomann
Copy link

Please see my stack overflow post here for an issue I'm facing when I apply these changes to my Podfile. I'm not really sure where to look for the problem; The error output I get when I run pods install doesn't hint me to where exactly the issue is:

[!] 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.

@petrbela
Copy link

petrbela commented Jul 28, 2019

Note that React Native changed how it defines React podspecs in v0.60, so this Podfile is no longer correct.

Still, to add unimodules support, just add use_unimodules! to your existing Podfile (until it gets autolinked?)

@thekrol01
Copy link

thekrol01 commented Jul 29, 2019

I think you also need to add: require_relative '../node_modules/react-native-unimodules/cocoapods.rb' at the top and delete the required path to nativemodules also.

@sudomann
Copy link

sudomann commented Jul 30, 2019

... and delete the required path to nativemodules also.

I don't know about that. I believe that would mean I also have to remove the line near the bottom of my Podfile that says
use_native_modules!. I don't know what it's there for, but I'm fearful of messing up dependencies I may not know how to fix.

@thekrol01
Copy link

thekrol01 commented Jul 30, 2019

Yes you have to remove that line too. At least i did :-)You won't be able to use the new autolink feature from react native 0.60 though. Because it uses the path to react native modules. So you have to do every install with podfiles. Perhaps it is best to experiment on a fresh new project. I did a complete new install with react 0.60 > and all dependencies with podfiles and everything workes fine.

@sudomann
Copy link

Oh no...I'd like to keep my project consistent by using only packages that are autolinked. Might as well make use of the feature since it's available. At least I know whenever I clone my code to a new location, I don't have to dig through my dependencies and figure out individual packages to perform setup steps for.

@darth-veitcher
Copy link

To get the Podfile working with react-native 0.60.5 I needed to make these changes:

  • change: platform :ios, '10.0'
  • add: require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
  • add: use_unimodules!

As a result my Podfile now looks like this:

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 'myApp' do
  # Pods for myApp
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  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 'myAppTests' do
    inherit! :search_paths
    # Pods for testing
  end

  use_native_modules!
end

target 'myApp-tvOS' do
  # Pods for dinklage-tvOS

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

end

Running a pod install --repo-update then seemed to work (albeit took an age to install...)

@smruti96
Copy link

How can I get the Podfile working for react native version 0.59?

I have added the following to my Podfile:
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
use_unimodules

Here is the error I ran into on pod install:
[!] CocoaPods could not find compatible versions for pod "UMTaskManagerInterface":
In Podfile:
UMTaskManagerInterface (from ../node_modules/unimodules-task-manager-interface/ios)
Specs satisfying the UMTaskManagerInterface (from ../node_modules/unimodules-task-manager-interface/ios) dependency were found, but they required a higher minimum deployment target.

@nolife08021
Copy link

nolife08021 commented Dec 17, 2019

@smruti96 hi Do you found the solution? I get error while running pod install too after i change platform :ios, '10.0'. RN0.59

[!] Unable to find a specification for React-Core depended upon by UMReactNativeAdapter

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.

@apostolou
Copy link

Hello, I'm facing the exact same problem as @nolife08021. Any ideas on how to fix it? Thx

@apostolou
Copy link

I manage to work around this error by downgrading the version of react-native-unimodules to 0.6.0. It seems that there is an issue with version 0.7.0

@sudomann
Copy link

sudomann commented Jan 8, 2020

@apostolou try these versions too, see how high you can go before the error occurs again ^0.7.0-rc.1 ^0.7.0-rc.2 ^0.7.0-rc.3 ^0.7.0-rc.4

@yuzhakovvv
Copy link

Have the same issues as @apostolou. 0.6.0 worked, but starting from 0.7.0-rc.1 have the same error as @nolife08021.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment