Custom xcframework not working rosetta simulator, But working in real device

68 views Asked by At

After the failure of universal framekwork with lipo. i created .xcframework. This is my structure of framework :

CustomFramework.xcframework

  • Info.plist
  • ios-arm64
  • ios-arm64_x86_64-simulator

This framework is working fine in real device. But when i try to run on rosetta simulator i am getting this below error :

Unsupported Swift architecture Could not build Objective-C module 'mylibraryname'

But when i delete ios-arm64 folder from my CustomFramework.xcframework, i was able to run on my rosetta simulator.

I choosed rosetta simulator from

Product > Destination > Destination architecture > show rosetta simulator/show both

For running on device i need to again add this ios-arm64 folder in to my CustomFramework.xcframework.

Client dont need two release builds, they need it in one go which should work in both simulator ( rosetta ) and release device.

My run script to generate .xcframework :

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"

Swift version, deployment versions are all same only. But still above one not wokring when both slice present in same framework. i tried adding the exclude architecture like belwo :

Exclude Architecture

  • Debug
    • Any iOS simulator = arm64
    • Any iOS SDK = x86_64

but still no luck. i need to delete the ios-arm64 folder in to my CustomFramework.xcframework to make it run on rosetta simulator. And re-add again to run on real device.


0

There are 0 answers