Cocoapods: 馃悰 : Unable to install pods using custom build configurations

Created on 28 Aug 2020  路  18Comments  路  Source: CocoaPods/CocoaPods

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: https://github.com/CocoaPods/CocoaPods/issues/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

Most helpful comment

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'])

All 18 comments

can you please upload a quick sample app demonstrating the issue?

@dnkoutso sure thing, I was able to reproduce very easily.

1) Used react-native init to just simply create a blank project
2) cd ios && pod install <-- Works fine
3) Create custom build configurations Staging.Debug, Staging.Release, Production.Debug, Production.Release
4) Add custom build configurations to pod file (see issue above)
5) run pod install <-- broken

Here is my repro project:

https://github.com/luskin/cocoapods-broken-custom-configurations

@luskin awesome thanks!

@luskin is there a reproducible case that does not include React-native? I want to rule that out as we have seen quite a few issues coming from that side that we do not maintain or support.

I also have zero experience or setup with React Native.

This specific issue though has nothing to do with react-native, the ios folder of the project is essentially just an ios project that installs a react-native pod from node_modules. I used react-native because it's a 1 line command to create a new iOS project with Podfile and all that. If it would help I can simply copy out the ios folder for you into its own repo.

It might help but I will also try to repro. The simpler the project the better.

it's extremely simple to run the project as is if you don't mind. all you have to do is run yarn install in the root directory, then cd ios && pod install.

@luskin thanks again. apologies for my naiveness and almost laziness!

@dnkoutso i'm working on it now actually and I could be onto something, it seems as though if I keep the standard Debug and Release build config names around, and then just copy them into NEW Staging and Production... etc configurations, that pod install succeeds as expected. I'll keep digging but it seems as though the problem occurs when there it can't find what I expect it's looking for, which is a default Debug and Release configuration name.

I think CocoaPods makes a lot of assumptions that debug/releases configurations exist.

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

This seems like a Flipper issue then?

This is a React Native issue, which used to integrate Flipper but not support pods configurations configurable til now.

So we can manually update the Podfile by rewriting the use_flipper! method to make it configurable for custom configurations

Seems like OK to close for now as the issue is not in CocoaPods.

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'])
Was this page helpful?
0 / 5 - 0 ratings