Skip to content

Instantly share code, notes, and snippets.

@rajagp
Created October 7, 2014 16:56
Show Gist options
  • Save rajagp/382f6f5c4c4f7aa8b703 to your computer and use it in GitHub Desktop.
Save rajagp/382f6f5c4c4f7aa8b703 to your computer and use it in GitHub Desktop.
Run script Build Phase to create a universal iOS8 framework using an aggregate target. The build target uses CocoaPods (so replace project/target with workspace/scheme).
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal
# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Replace with your scheme
SCHEME_NAME="MyScheme"
# Build Device and Simulator versions
xcodebuild ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -workspace "${PROJECT_DIR}/${PROJECT_NAME}.xcworkspace" -scheme ${SCHEME_NAME} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -workspace "${PROJECT_DIR}/${PROJECT_NAME}.xcworkspace" -scheme ${SCHEME_NAME} -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
# Copy the framework structure to the universal folder
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"
# Create universal binary file using lipo and place the combined executable in the copied framework directory
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment