Advanced CocoaPods integration
This guide assumes you’ve read the getting started guide for CocoaPods integration.
Preparation for trunk becoming read-only
Nutrient iOS SDK 14.6 will be our last release published to the CocoaPods specs repository (aka trunk) in preparation for this service becoming read-only. Our documentation has always shown adding our pod
using an explicit podspec
URL rather than from trunk, and this setup will continue to work. If you modified your Podfile to specify pod 'PSPDFKit'
only, then change this to include the podspec
argument, as shown below.
We recommend migrating from CocoaPods to Swift Package Manager, which is more modern and actively maintained.
Additional Podspec options
Always use the latest release (recommended)
use_frameworks! target :YourTargetName do pod 'PSPDFKit', podspec: 'https://my.nutrient.io/pspdfkit-ios/latest.podspec' end
Pinning to a specific version (e.g. 13.1.0)
use_frameworks! target :YourTargetName do pod 'PSPDFKit', podspec: 'https://my.nutrient.io/pspdfkit-ios/13.1.0.podspec' end
Using nightly builds
Replace latest.podspec
with nightly.podspec
to point to the latest nightly build:
use_frameworks! target :YourTargetName do pod 'PSPDFKit', podspec: 'https://my.nutrient.io/pspdfkit-ios/nightly.podspec' end
Using a JSON Podspec
CocoaPods makes a checksum of the JSON representation of your Podspec and keeps it in your Podfile.lock
file. If your development environment requires you to use a JSON Podspec, you can append .json
to your CocoaPods URL, like so:
use_frameworks! target :YourTargetName do pod 'PSPDFKit', podspec: 'https://my.nutrient.io/pspdfkit-ios/latest.podspec.json' end
To learn more about Podspec checksums, refer to the Why does my team’s Podfile.lock Podspec checksums change? blog post.
Using fat frameworks instead of XCFrameworks
Fat frameworks 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. See our getting started guide to learn how to integrate Nutrient using XCFrameworks.
We offer XCFrameworks as the default CocoaPods artifacts. If your project environment requires you to use old fat .framework
files instead, you can append -framework
to the version number of your CocoaPods URL, like so:
use_frameworks! target :YourTargetName do pod 'PSPDFKit', podspec: 'https://my.nutrient.io/pspdfkit-ios/latest-framework.podspec' end
Integrating Nutrient into test targets
You can add Nutrient to your test targets like this:
target :YourTargetNameTests do pod 'PSPDFKit', podspec: 'https://my.nutrient.io/pspdfkit-ios/latest.podspec' end
You can also use CocoaPods inheritance mode to inherit all of your main target’s dependencies by using inherit! :complete
, like so:
target :YourTargetNameTests do inherit! :complete end