CocoaPods Errors on Project Build

I had a similar problem when I did major changes to my Podfile. My solution was to remove the workspace file and run pod install again:

rm -rf MyProject.xcworkspace
pod install

TLDR: This is most likely a bug with Xcode and closing and reopening the project is usually the simplest fix. Assuming everything else is configured properly.


I occasionally get the same error when deleting the Pods directory and then running pod install.

Everything appears correct in the project info:

enter image description here

However, when I go to the target's User-Defined Build Settings, the PODS_ROOT entry is either entirely missing or is empty for one or more configurations. Which causes the following error on build:

enter image description here

The simplest fix is to close the project in Xcode and reopen it.

If you go to the target's Build Settings and filter on All, you will now see the PODS_ROOT entry with no errors:

enter image description here

It should now build with no errors.


Note: Even Cocoa Pods' official AFNetworking iOS Example has this problem, which leads me to believe that it is a bug with Xcode.

An alternative fix is to manually change the configuration to None, then back to its original value:

enter image description here