用指定xocde打包
/Applications/Xcode7.3.1.app/Contents/Developer/usr/bin/xcodebuild
1.最近做阿里云日志服务项目觉得蛮好用总结下
i386只能模拟器使用,arm只能真机使用,both是两者都能用但是不能上传appstore,会报如下错误。要上传appstore,只能用只能真机能用的库
(另外补充下:swift生成的framework,app最低操作系统支持是8.0系统)
a.只打真机能用的framework脚本
#!/bin/sh
PROJECT_NAME='AliyunLOGiOS'
SRCROOT='.'
# Sets the target folders and the final framework product.
FMK_NAME=${PROJECT_NAME}
# Install dir will be the final output to the framework.
# The following line create it in the root folder of the current project.
INSTALL_DIR=${SRCROOT}/Products/${PROJECT_NAME}.framework
# Working dir will be deleted after the framework creation.
WRK_DIR=build
DEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME}.framework
# -configuration ${CONFIGURATION}
# Clean and Building both architectures.
xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphoneos clean build
# Cleaning the oldest.
if [ -d "${INSTALL_DIR}" ]
then
rm -rf "${INSTALL_DIR}"
fi
mkdir -p ${SRCROOT}/Products
cp -R "${DEVICE_DIR}" "${INSTALL_DIR}"
rm -r "${WRK_DIR}"
b.只打模拟器能用的framework脚本
#!/bin/sh
PROJECT_NAME='AliyunLOGiOS'
SRCROOT='.'
# Sets the target folders and the final framework product.
FMK_NAME=${PROJECT_NAME}
# Install dir will be the final output to the framework.
# The following line create it in the root folder of the current project.
INSTALL_DIR=${SRCROOT}/Products/${PROJECT_NAME}.framework
# Working dir will be deleted after the framework creation.
WRK_DIR=build
DEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME}.framework
SIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME}.framework
# -configuration ${CONFIGURATION}
# Clean and Building both architectures.
xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphonesimulator clean build
# Cleaning the oldest.
if [ -d "${INSTALL_DIR}" ]
then
rm -rf "${INSTALL_DIR}"
fi
mkdir -p ${SRCROOT}/Products
cp -R "${SIMULATOR_DIR}" "${INSTALL_DIR}"
rm -r "${WRK_DIR}"
c.真机模拟器都能用的脚本(一般自己的git库里用,上传appstrore在替换成真机库)
#!/bin/sh
PROJECT_NAME='AliyunLOGiOS'
SRCROOT='.'
# Sets the target folders and the final framework product.
FMK_NAME=${PROJECT_NAME}
# Install dir will be the final output to the framework.
# The following line create it in the root folder of the current project.
INSTALL_DIR=${SRCROOT}/Products/${PROJECT_NAME}.framework
# Working dir will be deleted after the framework creation.
WRK_DIR=build
DEVICE_DIR=${WRK_DIR}/Release-iphoneos/${FMK_NAME}.framework
SIMULATOR_DIR=${WRK_DIR}/Release-iphonesimulator/${FMK_NAME}.framework
# -configuration ${CONFIGURATION}
# Clean and Building both architectures.
xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphoneos clean build
xcodebuild -configuration "Release" -target "${FMK_NAME}" -sdk iphonesimulator clean build
# Cleaning the oldest.
if [ -d "${INSTALL_DIR}" ]
then
rm -rf "${INSTALL_DIR}"
fi
mkdir -p ${SRCROOT}/Products
cp -R "${DEVICE_DIR}" "${INSTALL_DIR}"
# Uses the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.
lipo -create "${DEVICE_DIR}/${FMK_NAME}" "${SIMULATOR_DIR}/${FMK_NAME}" -output "${INSTALL_DIR}/${FMK_NAME}"
rm -r "${WRK_DIR}"
#if [ -d "${INSTALL_DIR}/_CodeSignature" ]
#then
# rm -rf "${INSTALL_DIR}/_CodeSignature"
#fi
#if [ -f "${INSTALL_DIR}/Info.plist" ]
#then
# rm "${INSTALL_DIR}/Info.plist"
#fi
2.如何使用脚本
如果您发现本文对你有所帮助,如果您认为其他人也可能受益,请把它分享出去。