Carthage Integration

This guide covers the steps needed to use the Carthage dependency manager to add PSPDFKit to an iOS app.

Warning

Fat frameworks, which are used by Carthage, are a legacy distribution option that rely on iOS devices and Simulator using different processor architectures. Using fat frameworks leads to undefined behavior when running on Simulator on Apple silicon Macs and can cause crashes because the ARM64 slice isn’t compiled for a simulator. XCFrameworks are Apple’s solution to this problem. We recommend migrating from Carthage to Swift Package Manager, which uses XCFrameworks.

  1. Open your project’s Cartfile in a text editor and add the PSPDFKit dependency:

binary "https://my.pspdfkit.com/pspdfkit-ios.json"
Information

The Carthage JSON URL from above will ensure you always use the latest available version of PSPDFKit. Alternatively, you can select a specific version to update at your own pace. Take a look at our advanced Carthage integration guide for more details.

  1. In the terminal, change the directory to the location of your Cartfile: cd path/to/Cartfile.

  2. Run carthage update and wait for Carthage to download PSPDFKit.

  3. Open your application’s project or workspace in Xcode.

  4. Drag the binaries from Carthage/Build/iOS into the Frameworks, Libraries, and Embedded Content section of your target.

drag-and-drop-frameworks

  1. To work around the compatibility issue between fat frameworks and Xcode 12, make sure EXCLUDED_ARCHS for iOS Simulator SDK is set to arm architectures (arm64) in your project configuration. This ensures you’ll avoid running into an issue while building for iOS Simulator:

"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;

drag-and-drop-frameworks