React Native Xcode Build Failure Fix (CocoaPods)

If you’re building iOS apps with React Native, you’ll eventually run into an Xcode build failure similar to this one:

Build target MyApp of project MyApp with configuration Debug
error: /Users/david/Dev/myapp-app/ios/Pods/Target Support Files/Pods-MyApp/Pods-MyApp.debug.xcconfig: unable to open file (in target "MyApp" in project "MyApp") (in target 'MyApp' from project 'MyApp')
error: /Users/david/Dev/myapp-app/ios/Pods/Target Support Files/Pods-MyApp/Pods-MyApp.debug.xcconfig: unable to open file (in target "MyApp" in project "MyApp") (in target 'MyApp' from project 'MyApp')
error: /Users/david/Dev/myapp-app/ios/Pods/Target Support Files/Pods-MyApp/Pods-MyApp.debug.xcconfig: unable to open file (in target "MyApp" in project "MyApp") (in target 'MyApp' from project 'MyApp')
error: /Users/david/Dev/myapp-app/ios/Pods/Target Support Files/Pods-MyApp/Pods-MyApp.debug.xcconfig: unable to open file (in target "MyApp" in project "MyApp") (in target 'MyApp' from project 'MyApp')

It has happened to me twice now in 2020, and I sort of accidentally found out that you can solve it by updating CocoaPods to the latest version. Go inside the root of your React Native project and run this command:

sudo gem install cocoapods

This will update CocoaPods to the latest version. It’s generally recommended to keep CocoaPods up to date, especially around new Xcode releases.

Then go to your projects iOS folder (cd ios) and run:

pod install

Now try running your project in Xcode again.

There’s no guarantee that it’ll work, but it has done the trick twice for me so far.


Has this been helpful to you?

You can support my work by sharing this article with others, or perhaps buy me a cup of coffee 😊

Kofi

Share & Discuss on