Bytedance-UnionAD
Bytedance-UnionAD copied to clipboard
[Feature] Add support for Apple Silicon (M1)
Is your feature request related to a problem? Please describe. | 提出这个建议是因为遇到了什么问题?
All shipped frameworks break iOS Simulator builds on Apple Silicon (M1 macs).
Describe the solution you'd like. | 描述你期望的解决方案。
I want to be able to run apps with Bytedance SDKs in iOS simulator on M1 macs. XCFrameworks are required to include the arm64 slice for iOS devices and the macOS simulator for Macs running on Apple silicon.
Additional context | 额外信息
Migration process:
- Recompile libraries as XCFrameworks with
arm64-simulator
slice. - Remove deprecated
EXCLUDED_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:
# archive framework for device targets
xcodebuild archive -project 'Project.xcodeproj' -scheme 'FrameworkDemo' -configuration Release -destination 'generic/platform=iOS' -archivePath 'archive/FrameworkDemo-iphoneos.xcarchive' SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
# archive framework for simulator targets (code signing not required)
xcodebuild archive -project 'Project.xcodeproj' -scheme 'FrameworkDemo' -configuration Release -destination 'generic/platform=iOS Simulator' -archivePath 'archive/FrameworkDemo-iphonesimulator.xcarchive' SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGN_ENTITLEMENTS="" CODE_SIGNING_ALLOWED="NO"
# build XCFramework
xcodebuild -create-xcframework \
-framework archive/FrameworkDemo-iphoneos.xcarchive/Products/Library/Frameworks/FrameworkDemo.framework \
-framework archive/FrameworkDemo-iphonesimulator.xcarchive/Products/Library/Frameworks/FrameworkDemo.framework \
-output archive/FrameworkDemo.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-notes -
VALID_ARCHS
issues https://github.com/search?q=VALID_ARCHS&type=issues -
Cocoapods 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
M1 has been out almost 2 years now, we need XCFramework
to support it.
Related issues: #152 #144 #63
Any update on this?
If you don't have an Apple Silicon Mac to compile the .xcframework
there are now even cloud services you can use.
It just needs compiling as an .xcframework
and then we can use it.
We just dropped the SDK ¯_(ツ)_/¯
This issue also affects the implementation of other frameworks. We hope this issue will be resolved soon.
Please prioritize this issue. The development experience with the bytedance SDK on Apple Silicon Macs is unbearable.
For the authors: https://developer.apple.com/documentation/technotes/tn3117-resolving-build-errors-for-apple-silicon#Update-pre-compiled-libraries-from-vendors
Looks like xcframework including arm64 simulator is finally supported since 5.1.0.6.
- https://github.com/bytedance/Bytedance-UnionAD/pull/190
Thank you for your feed back. We have supported xcframework including arm64 simulator since 5.1.0.0.