Shipped framework breaks iOS Simulator builds on Apple Silicon (M1 macs).
XCFrameworks are required to include the arm64 slice for iOS devices and the macOS simulator for Macs running on Apple silicon.
Migration process:
1) Recompile libraries as XCFrameworks with arm64-simulator slice.
2) Remove deprecated EXCLUDED_ARCHS[1] and VALID_ARCHS[2] build configuration overrides from podspecs (remove all uses of spec.pod_target_xcconfig and spec.user_target_xcconfig).
Simplified example of building framework target as XCFramework:
"Only use the EXCLUDED_ARCHS build setting on targets where the final released app is not using the target’s functionality on a specific architecture, such as a Mac app that only supports a legacy feature on Intel-based Mac computers ... Do not use EXCLUDED_ARCHS with pre-compiled libraries that are not updated with support for the iOS, watchOS, or tvOS simulators on Apple silicon."
Shipped framework breaks iOS Simulator builds on Apple Silicon (M1 macs).
XCFrameworks are required to include the arm64 slice for iOS devices and the macOS simulator for Macs running on Apple silicon.
Migration process:
1) Recompile libraries as XCFrameworks with
arm64-simulator
slice. 2) Remove deprecatedEXCLUDED_ARCHS
[1] andVALID_ARCHS
[2] build configuration overrides from podspecs (remove all uses ofspec.pod_target_xcconfig
andspec.user_target_xcconfig
).Simplified example of building framework target as XCFramework:
References:
WWDC19 XCFramework announcement https://www.wwdcnotes.com/notes/wwdc19/416/
Create an XCFramework https://help.apple.com/xcode/mac/current/#/dev544efab96
Supporting XCFrameworks by PSPDFKit https://pspdfkit.com/blog/2020/supporting-xcframeworks/, https://pspdfkit.com/blog/2021/advances-in-xcframeworks/
XCFramework example project https://github.com/bielikb/xcframeworks
Cocoapods podspec examples with binary XCFrameworks: FirebaseAnalytics UnityAds PSPDFKit OneSignal FBSDKCoreKit
TN3117: Resolving architecture build errors on Apple silicon https://developer.apple.com/documentation/technotes/tn3117-resolving-build-errors-for-apple-silicon
"Only use the
EXCLUDED_ARCHS
build setting on targets where the final released app is not using the target’s functionality on a specific architecture, such as a Mac app that only supports a legacy feature on Intel-based Mac computers ... Do not useEXCLUDED_ARCHS
with pre-compiled libraries that are not updated with support for the iOS, watchOS, or tvOS simulators on Apple silicon."VALID_ARCHS
flag has been deprecated since Xcode 12 (September 2020) https://developer.apple.com/documentation/xcode-release-notes/xcode-12-release-notesVALID_ARCHS
issues https://github.com/search?q=VALID_ARCHS&type=issuesCocoapods docs: "
user_target_xcconfig
attribute is not recommended as Pods should not pollute the build settings of the user project and this can cause conflicts." https://guides.cocoapods.org/syntax/podspec.html#user_target_xcconfig