Skip to content

Instantly share code, notes, and snippets.

@skywinder
Last active October 14, 2018 15:41
Show Gist options
  • Save skywinder/7ff35502d4f33e072add to your computer and use it in GitHub Desktop.
Save skywinder/7ff35502d4f33e072add to your computer and use it in GitHub Desktop.
Export “fat” Cocoa Touch Framework (for Simulator and Device)
#run this script from Product page in your project Derived Data folder
framework_name="${$(basename $(find ./Debug-iphoneos -type d -name '*.framework' -maxdepth 1))%.*}" && \
cp -R Debug-iphoneos/$framework_name.framework ./$framework_name.framework && \
lipo -create -output "$framework_name.framework/$framework_name" \
"Debug-iphonesimulator/$framework_name.framework/$framework_name" \
"Debug-iphoneos/$framework_name.framework/$framework_name"
@muzammil-triffort
Copy link

bad substitution error. Any suggestion?

@freemansion
Copy link

this http://stackoverflow.com/a/26691080/1994889 solution works well in my case

@inso-
Copy link

inso- commented Oct 2, 2017

I fix the bad substitution error:

framework_name=$(basename find ./Debug-iphoneos -type d -name '*.framework' -maxdepth 1 | cut -f 1 -d '.') &&
cp -R Debug-iphoneos/$framework_name.framework ./$framework_name.framework &&
lipo -create -output "$framework_name.framework/$framework_name"
"Debug-iphonesimulator/$framework_name.framework/$framework_name"
"Debug-iphoneos/$framework_name.framework/$framework_name"

@immortalsantee
Copy link

This code removed bad substitution error.

#run this script from Product page in your project Derived Data folder

framework_name=$(basename $(find ./Debug-iphoneos -type d -name '*.framework' -maxdepth 1) | cut -f 1 -d '.') && \
cp -R Debug-iphoneos/$framework_name.framework ./$framework_name.framework && \
lipo -create -output "$framework_name.framework/$framework_name" \
"Debug-iphonesimulator/$framework_name.framework/$framework_name" \
"Debug-iphoneos/$framework_name.framework/$framework_name"

This did create fat file successfully. However, the .swiftmodule only contains arm64 files. I imported the framework into the project but cannot run in the simulator. It is supported only for a device.

Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment