for anyone who is still facing this issue I think you just need to run this command:
sudo gem install cocoapods pod cache clean --all rm -rf ios/Pods ios/Podfile.lock pod install --project-directory=ios
and it will work fines with you