Carthage integration

This guide covers the steps needed to use the Carthage(opens in a new tab) dependency manager to add Nutrient to an iOS app.

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 Nutrient dependency:
Terminal window
binary "https://my.nutrient.io/pspdfkit-ios.json"

The Carthage JSON URL from above will ensure you always use the latest available version of Nutrient. 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 Nutrient.

  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(opens in a new tab), 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