Search code examples
iosreact-nativecocoapods

Unable to find a specification for `React-Core` depended upon by `RNCPicker` 1.6.0 with React Native 0.59


I was getting this error when running pod install for RNCPicker of version 1.6.0 with React Native 0.59

Analyzing dependencies
[!] Unable to find a specification for `React-Core` depended upon by `RNCPicker`

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.

In my case I have to use these specific versions. How do I get rid of this error?


Solution

  • React-Core is outdated and has been renamed to React

    I have added the following lines to the bottom of my Podfile under ios.

    def change_lines_in_file(file_path, &change)
      print "Fixing #{file_path}...\n"
      
      contents = []
      
      file = File.open(file_path, 'r')
      file.each_line do | line |
        contents << line
      end
      file.close
      
      File.open(file_path, 'w') do |f|
        f.puts(change.call(contents))
      end
    end
    
    change_lines_in_file('../node_modules/@react-native-community/picker/RNCPicker.podspec') do |lines|
      lines.map { |line| line.include?("s.dependency 'React-Core'") ? "s.dependency 'React'" : line}
    end
    

    In this way, everytime when I am trying to run pod install, it finds my outdated RNCPicker and replace the React-Core dependency name to React