Removing Architectures
PSPDFKit.framework
and PSPDFKitUI.framework
are distributed as fat frameworks for Carthage. These frameworks contain two architectures: arm64
and x86_64
. The ARM architecture is for devices, while the x86_64
architecture is for the Simulator.
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.
If these slices aren’t removed, Apple will reject the binary. Xcode will emit an error that says: “iTunes Store Operation Failed: Unsupported Architectures. The executable YourApp contains unsupported architectures ‘[(x86_64, i386)]’.” There might be additional errors, such as “LC_ENCRYPTION_INFO,” “Invalid Segment Alignment,” or “The binary is invalid.” Removing Simulator architectures resolves these issues.
Manually Stripping Architectures
You can manually strip the framework to remove slices not required for the app:
lipo -remove x86_64 -output PSPDFKit.framework/PSPDFKit PSPDFKit.framework/PSPDFKit lipo -remove x86_64 -output PSPDFKitUI.framework/PSPDFKitUI PSPDFKitUI.framework/PSPDFKitUI
You can verify that the architectures are removed via file
:
file PSPDFKit.framework/PSPDFKit
Learn More
PSPDFKit phased out armv7s support with PSPDFKit 4 for iOS.
Find out more about the framework size.