davidpricedev
davidpricedev

Reputation: 2237

How to add `pod install` step to ios build process

I have just installed a dependency in my react-native project that required manual configuration of ios/Podfile.

If I have a fresh clone of the repository for this project, react-native run-ios will fail to work until I run pod install within the context of the ios folder. I'd like to get that to automatically happen as part of the ios build instead of being a separate step.

I've tried adding pod install as a "Run Script" in xcode and moved it to the top of the build order, but no luck with that.

How can I add a pod install step to the ios build process?

Upvotes: 1

Views: 1100

Answers (1)

Aleksandr Medvedev
Aleksandr Medvedev

Reputation: 9008

I think it's easier to specify a separate script in your package scripts:

{
  "name": "Awesome Project",
  "version": "1.8.0",
  "scripts": {
    "start-ios": "cd ./ios && pod install && cd .. && react-native run-ios",
  },
  ...some other stuff here...
}

P.S. It doesn't seem to be wise to install pods whenever you want to build an app. It requires many redundant steps, and you want to consider just including pods sources in your repository, that is way better IMHO. (if installing pods once after clonning the repo is not an option)

Upvotes: 2

Related Questions