Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Invalid Podfile file: undefined method `use_flipper!' for an instance of Pod::Podfile. #5685

Open
adey69 opened this issue Nov 22, 2024 · 0 comments

Comments

@adey69
Copy link

adey69 commented Nov 22, 2024

I created a new React Native project using react-native init and ran my app successfully. Although previously React Native supported Flipper out-of-the box, but that support has been removed now according to official documentation of React Native. I tried to manually integrate Flipper for the iOS app (because my current focus is iOS only), but I'm getting the following error when running pod install.

[Codegen] >>>>> Searching for codegen-enabled libraries in react-native.config.js
[Codegen] Processing FBReactNativeSpec
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Processing rncore
[Codegen] Searching for podspec in the project dependencies.
[Codegen] Generating Native Code for FBReactNativeSpec - ios
[Codegen] Generated artifacts: /Users/bsadmin/Documents/Learning/FlipperTesting/ios/build/generated/ios
[Codegen - rncore] Skipping iOS code generation for rncore as it has been generated already.
[Codegen] Creating component provider.
[Codegen] Generated provider in: /Users/bsadmin/Documents/Learning/FlipperTesting/node_modules/react-native/React/Fabric
[Codegen] Done.

[!] Invalid `Podfile` file: undefined method `use_flipper!' for an instance of Pod::Podfile.

 #  from /Users/bsadmin/Documents/Learning/FlipperTesting/ios/Podfile:30
 #  -------------------------------------------
 #    
 >    use_flipper!({'Flipper' => '0.272.0'}) # should match the version of your Flipper client app
 #    post_install do |installer|
 #  -------------------------------------------

[!] [Codegen] warn: using experimental new codegen integration

My Podfile is as follows:

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, min_ios_version_supported

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

prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'FlipperTesting' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  
  use_flipper!({'Flipper' => '0.272.0'}) # should match the version of your Flipper client app
  post_install do |installer|
    flipper_post_install(installer)
  end

  target 'FlipperTestingTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end
end

Relevant package.json part:

{
  "dependencies": {
    "react": "18.3.1",
    "react-native": "0.76.2",
    "react-native-flipper": "^0.273.0"
  },
}

If someone has integrated Flipper in newer versions, I would appreciate the support in pointing out what I'm doing wrong. Also, details about the Android integration would be a bonus.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant