Search code examples
iosxcodereact-nativecocoapods

Unknown configuration whitelisted: . CocoaPods found debug and release, did you mean one of these? React Native


I am trying to do pod install in my React native app. but it shows me the following error.

Auto-linking React Native modules for target `<projectname>`: RNScreens, RNVectorIcons, and react-native-safe-area-context
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
/Users/belgin/Documents/Apps/<projectname>/node_modules/react-native/scripts/react_native_pods_utils/script_phases.rb:50: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.
/Users/belgin/Documents/Apps/<projectname>/node_modules/react-native/scripts/react_native_pods_utils/script_phases.rb:50: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
[!] Unknown configuration whitelisted: . CocoaPods found debug and release, did you mean one of these?

This started happening after i upgraded my react native version. I tried the following solution

Cocoapods Warning - CocoaPods did not set the base configuration of your project because because your project already has a custom config set

but nothing seems to work.

My 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, '11.0'
install! 'cocoapods', :deterministic_uuids => false

target '<ProjectName>' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target '<ProjectName>' 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 the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end


Solution

  • Actually after looking for solutions I did this and it worked.

    1. Go to node_modules/@react-native-community/cli-platform-ios/build/config/index.js

    2. replace this line let configurations = []; under the dependencyConfig function

    with the following lines below

    let configurations = [];
    if(userConfig) {
      configurations = userConfig.configurations || [];
    }
    
    1. Then pod install