SolvedCocoaPods πŸ› : Unable to install pods using custom build configurations

What did you do?

  1. Created 2 new build configurations and renamed the default Debug and Release configurations, configurations looks like this:

Screen Shot 2020-08-27 at 2 54 17 PM

  1. Created two new schemes, Staging and Production

  2. Added new build configurations, as currently understood from the documentation here, to the podfile like so:

platform :ios, '10.0'

project 'Project',
  'Staging.Debug' => :debug,
  'Staging.Release' => :release,
  'Production.Debug' => :debug,
  'Production.Release' => :release

target 'Project' do
  ...
  1. Run pod install

What did you expect to happen?

Install all pod dependencies correctly.

What happened instead?

Receive an error that cocoapods is unable to find the configuration whitelisted? This error is very confusing and the only thing I can find on it a small issue regarding providing more information on the error, see here: #5113

[!] Unknown configuration whitelisted: debug. CocoaPods found production.debug, production.release, staging.debug, and staging.release, did you mean one of these?

CocoaPods Environment

Stack

   CocoaPods : 1.8.4
        Ruby : ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
    RubyGems : 3.0.3
        Host : Mac OS X 10.15.6 (19G2021)
       Xcode : 11.6 (11E708)
         Git : git version 2.24.3 (Apple Git-128)
Ruby lib dir : /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Installation Source

Executable Path: /usr/local/bin/pod

Plugins

cocoapods-deintegrate : 1.0.4
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.0
cocoapods-stats       : 1.1.0
cocoapods-trunk       : 1.4.1
cocoapods-try         : 1.1.0

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, '10.0'

project 'Project',
  'Staging.Debug' => :debug,
  'Staging.Release' => :release,
  'Production.Debug' => :debug,
  'Production.Release' => :release

target 'Project' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # STRIPE
  pod 'Stripe', '~> 19.0.1'
  pod 'tipsi-stripe', :path => '../node_modules/tipsi-stripe'

  # PERMISSIONS
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-LocationAlways', :path => "#{permissions_path}/LocationAlways.podspec"
  pod 'Permission-Notifications', :path => "#{permissions_path}/Notifications.podspec"

  target 'ProjectTests' 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 these next few lines.
  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)
  end
end
20 Answers

βœ”οΈAccepted Answer

Just to leave a clear solution here. Thankfully the solution is already merged, to RN 0.63.3, so you can either:

  • comment use_flipper! in the Podfile
  • add your configurations to the line like this: use_flipper!(configurations: ['DebugConfig', 'ReleaseConfig'])

Other Answers:

I'm also experiencing exactly the same issue as the OP. The issue is apparently with the "use_flipper" function that was introduced by react native 0.63+, when i comment it out i am able to execute "pod install". This is my podfile with a bit of obfuscation:

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

platform :ios, '12.0'

project 'app', 'dev' => :debug, 'staging' => :release, 'production' => :release

abstract_target "shared_pods" do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  # React Native Maps dependencies
  rn_maps_path = '../node_modules/react-native-maps'
  pod 'react-native-google-maps', :path => rn_maps_path
  pod 'GoogleMaps'
  pod 'Google-Maps-iOS-Utils'

  # React Native Permissions
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-LocationWhenInUse', :path => "#{permissions_path}/LocationWhenInUse.podspec"

  target 'TARGET_DE' do
    inherit! :complete
	end

  target 'TARGET_AT' do
    inherit! :complete
	end

  target 'TARGET_US' do
    inherit! :complete
  end
  # this config is currently not working
  # use_flipper!(configurations: ['dev', 'staging', 'production'])
end

post_install do |pi|
    flipper_post_install(pi)
    pi.pods_project.targets.each do |t|
        t.build_configurations.each do |config|
            config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '12.0'
            if config.name == 'dev'
              config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'DEBUG=1']
              config.build_settings['OTHER_SWIFT_FLAGS'] = ['$(inherited)', '-DDEBUG']
            end
        end
    end
end

You can define use_flipper! in your Podfile directly

......
# Will remove when upgrade to react-native 0.63.3 https://github.com/facebook/react-native/pull/29074
def use_flipper!(versions = {}, configurations: ['Debug'])
  versions['Flipper'] ||= '~> 0.55.0'
  versions['Flipper-DoubleConversion'] ||= '1.1.7'
  versions['Flipper-Folly'] ||= '~> 2.2'
  versions['Flipper-Glog'] ||= '0.3.6'
  versions['Flipper-PeerTalk'] ||= '~> 0.0.4'
  versions['Flipper-RSocket'] ||= '~> 1.1.0'
  pod 'FlipperKit', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitLayoutPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/SKIOSNetworkPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitUserDefaultsPlugin', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitReactPlugin', versions['Flipper'], :configurations => configurations
  # List all transitive dependencies for FlipperKit pods
  # to avoid them being linked in Release builds
  pod 'Flipper', versions['Flipper'], :configurations => configurations
  pod 'Flipper-DoubleConversion', versions['Flipper-DoubleConversion'], :configurations => configurations
  pod 'Flipper-Folly', versions['Flipper-Folly'], :configurations => configurations
  pod 'Flipper-Glog', versions['Flipper-Glog'], :configurations => configurations
  pod 'Flipper-PeerTalk', versions['Flipper-PeerTalk'], :configurations => configurations
  pod 'Flipper-RSocket', versions['Flipper-RSocket'], :configurations => configurations
  pod 'FlipperKit/Core', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/CppBridge', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FBCxxFollyDynamicConvert', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FBDefines', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FKPortForwarding', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitHighlightOverlay', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitLayoutTextSearchable', versions['Flipper'], :configurations => configurations
  pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configurations => configurations
end
......

target '****' do
  ......
  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  use_flipper!(configurations: ['dev'])
  post_install do |installer|
    flipper_post_install(installer)
  end

More Issues: