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.
- Open your project’s Cartfile in a text editor and add the Nutrient dependency:
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.
In the terminal, change the directory to the location of your Cartfile:
cd path/to/Cartfile
.Run
carthage update
and wait for Carthage to download Nutrient.Open your application’s project or workspace in Xcode.
Drag the binaries from
Carthage/Build/iOS
into the Frameworks, Libraries, and Embedded Content section of your target.
- 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;