Archive Fails When Using CocoaPods

Q: I am using CocoaPods, and I am getting the following linker issue when archiving my app:

building for iOS, but linking in dylib file (/Users/radazzouz/Library/Developer/Xcode/DerivedData/Catalog-azzqyxicviyzlcgalyuumdxhcawg/Build/Intermediates.noindex/ArchiveIntermediates/Catalog/BuildProductsPath/Release-iphoneos/PSPDFKit.framework/PSPDFKit) built for iOS Simulator, file '/Users/radazzouz/Library/Developer/Xcode/DerivedData/Catalog-azzqyxicviyzlcgalyuumdxhcawg/Build/Intermediates.noindex/ArchiveIntermediates/Catalog/BuildProductsPath/Release-iphoneos/PSPDFKit.framework/PSPDFKit' for architecture arm64

A: This occurs because you may be using an older version of CocoaPods. PSPDFKit 10 for iOS requires CocoaPods 1.10.0 or later.

To fix this issue, please follow the steps below:

  1. Update to the latest version of CocoaPods: sudo gem install cocoapods

  2. Remove your Podfile.lock: rm Podfile.lock

  3. Deintegrate your Pods: pod deintegrate

  4. Make sure your Podfile points to the latest version of PSPDFKit.

  5. Run pod install