Skip to content

Instantly share code, notes, and snippets.

@sjchmiela
Created March 12, 2019 12:03
Show Gist options
  • 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
@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