I struggled with this for a while recently so I thought I would share the end result. I’ve been trying to figure out how to generate a universal framework for iOS (i.e. one that will run in both the simulator as well as on an actual device). The following shell script, when located in the same directory as the .xcodeproj file, will invoke xcodebuild twice on a framework project and join the resulting binaries together into a single universal binary. It will then package the framework up in a gzipped tarball and place it in the same directory.
export FRAMEWORK=your framework name rm -Rf build rm $FRAMEWORK.framework.tar.gz xcodebuild -project $FRAMEWORK.xcodeproj -sdk iphonesimulator -target $FRAMEWORK xcodebuild -project $FRAMEWORK.xcodeproj -sdk iphoneos -target $FRAMEWORK lipo build/Release-iphonesimulator/$FRAMEWORK.framework/$FRAMEWORK build/Release-iphoneos/$FRAMEWORK.framework/$FRAMEWORK -create -output $FRAMEWORK.lipo mv $FRAMEWORK.lipo build/Release-iphoneos/$FRAMEWORK.framework/$FRAMEWORK tar -czv -C build/Release-iphoneos -f $FRAMEWORK.framework.tar.gz $FRAMEWORK.framework
Hope it helps!