I have created one xcframework library by using this below script :
[# Type a script or drag a script file from your workspace to insert its path.
#Gerenate device framework
xcodebuild archive -scheme ${PROJECT_NAME} -archivePath "${PROJECT_DIR}/build/${PROJECT_NAME}-iphoneos.xcarchive" -sdk iphoneos SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
#Generate simulator framework
xcodebuild archive -scheme ${PROJECT_NAME} -archivePath "${PROJECT_DIR}/build/${PROJECT_NAME}-iossimulator.xcarchive" -sdk iphonesimulator SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
#Generate xcframework for both arches
xcodebuild -create-xcframework -framework "${PROJECT_DIR}/build/${PROJECT_NAME}-iphoneos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" -framework "${PROJECT_DIR}/build/${PROJECT_NAME}-iossimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" -output "${PROJECT_DIR}/build/${PROJECT_NAME}.xcframework"
#Open directory where xcframework were generate
open "${PROJECT_DIR}/build"](https://www.example.com/)
its generated this folder with two slices.:
JawwyGamification.xcframework
- ios-arm64
- ios-arm64_x86_64-simulator
- Info.plist
When i try to run on real device and apple slicon based simulator its wokring fine. But when i try to run on rosetta simulator in my m1 mac xcode 14.3.1 i am getting unsuportted swift architecture error on ios-arm64 folder framework header .h file
Also i excluded the archtectire for my library and in project settings Any iOS simualator - arm64
then also no luck. but the wired thing is if i rearrange the slice order to this :
JawwyGamification.xcframework
- ios-arm64_x86_64-simulator
- ios-arm64
- Info.plist
its working fine in all simulator and real device. I understand when i run on m1 mac rosetta simulator its failing to take the ios-arm64_x86_64-simulator. So the error is showing on ios-arm64 slice framework header
Any idea to fix this.
Additional info :
in my project library. :
- Its an release build
- Build Active architecture only - NO
- Architecture - Standard