Invalid Podfile file: undefined method `enable_user_defined_build_types!'

Viewed 8730

I have installing gem on a Macbook Pro running Big Sur and M1 chip. I have followed the instructions given, added these two lines on top of my Podfile

plugin 'cocoapods-user-defined-build-types'
enable_user_defined_build_types!

then I am running the command

sudo gem install 'cocoapods-user-defined-build-types'

and gem is getting installed see below -

Successfully installed cocoapods-user-defined-build-types-0.0.7
Parsing documentation for cocoapods-user-defined-build-types-0.0.7
Done installing documentation for cocoapods-user-defined-build-types after 0 seconds
1 gem installed

Now, as soon as I run pod install, I get this error -

[!] Invalid Podfile file: undefined method `enable_user_defined_build_types!' for #<Pod::Podfile:0x0000000145251098 @defined_in_file=#<Pathname

Any idea what excatly is the problem here?

2 Answers

I solved this issue by installing specific version of cocoapods with gem.

Open a terminal in your Xcode project folder and run the commands below:

  1. gem cleanup
  2. brew uninstall cocoapods
  3. sudo gem uninstall cocoapods
  4. sudo gem install cocoapods -v 1.10.0 -n /usr/local/bin
  5. sudo gem install cocoapods-user-defined-build-types
  6. pod install --repo-update

NOTE! If you using react-native before pod install --repo-update delete your node_modules folder and install again using npm

I was struggling to get a solution,

I was trying to install the snapkit and Firebase through cocoapods, I got pod init, but after insert inside the podfile the e.g. Snpakit when I tried the comand pod install i got this issue [!] Invalid Podfile file: undefined method......

What solved for me

  • I installed the brew through terminal and by brew I reinstalled cocoapods

another thing that was crucial... when I typed insert my pod

pod 'SnapKit', '~> 5.6.0'

The Podfile, automatically change de first character to uppercase

Pod 'SnapKit', '~> 5.6.0'

After you type your pod, try to leave the word pod in lowercase, after save and close, go to terminal and try again pod install

Related