For me, none of the above answers worked.
Something I did terribly wrong was setting a flag in Other Swift Flags in the Build Settings. Which override cocoapods custom flags.
It shows an error something like this in that case.
Pod installation complete! There are 16 dependencies from the Podfile and 29 total pods installed.
[!] The `***** [Debug]` target overrides the `OTHER_SWIFT_FLAGS` build setting defined in
`Pods/Target Support Files/Pods-MishiPay/Pods-MishiPay.debug.xcconfig'. This can lead
to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
So Instead of removing my other custom flags. I added one more flag $(inherited)
after this everything worked fine.

$(inherited)
inherits all the custom flags defined by cocoapods