Archive Fails When Using CocoaPods

Q: I’m using CocoaPods and 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, follow the steps below:

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

  2. Remove your Podfile.lock using rm Podfile.lock.

  3. Deintegrate your pods using pod deintegrate.

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

  5. Run pod install.