Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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"
@federicocappelli

This comment has been minimized.

Copy link

federicocappelli commented Aug 25, 2015

Execute in Product folder, with Debug-iphoneos and Debug-iphonesimulator as subfolders

./create_fat_framework.sh: line 2: ${$(basename $(find ./Debug-iphoneos -type d -name '*.framework' -maxdepth 1))%.*}: bad substitution
@jose920405

This comment has been minimized.

Copy link

jose920405 commented May 5, 2016

Error -bash: ${$(basename $(find ./Debug-iphoneos -type d -name '*.framework' -maxdepth 1))%.*}: bad substitution

@muzammil-triffort

This comment has been minimized.

Copy link

muzammil-triffort commented Aug 3, 2016

bad substitution error. Any suggestion?

@freemansion

This comment has been minimized.

Copy link

freemansion commented Sep 15, 2016

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

@inso-

This comment has been minimized.

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

This comment has been minimized.

Copy link

immortalsantee commented Jan 17, 2018

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
You can’t perform that action at this time.