首页 > 其他 > 详细

framework 工程搭建

时间:2019-07-25 13:36:54      阅读:105      评论:0      收藏:0      [点我收藏+]

1. 创建workspace

技术分享图片

2. 创建framework工程

技术分享图片

3. 创建Demo工程

技术分享图片

4. 创建成功

技术分享图片

5. 设置SDK工程配置

技术分享图片

技术分享图片

技术分享图片

6. 设置Headers,将要公开的头文件拖到Public下,要隐藏的放到Private或Project下,隐藏的头文件不能被引用,效果图: 

技术分享图片

7. 创建一个Aggregare

选中SDK工程->Editor->Add Target

技术分享图片

技术分享图片

8. 嵌入脚本,选中刚刚创建的Aggregare,然后选中右侧的Build Phases,点击左边的+号,选择New Run Script Phases

9. 下面把这段脚本复制进去(格式不要错,格式错编译不通过)

# Type a script or drag a script file from your workspace to insert its path.

# Sets the target folders and the final framework product.

# 如果工程名称和Framework的Target名称不一样的话,要自定义FMKNAME

# 例如: FMK_NAME ="MyFramework"

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/${FMK_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 build

xcodebuild -configuration "Debug" -target "${FMK_NAME}" -sdk iphonesimulator build

# Cleaning the oldest.

if [ -d "${INSTALL_DIR}" ]

then

rm -rf "${INSTALL_DIR}"

fi

mkdir -p "${INSTALL_DIR}"

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}"

open "${INSTALL_DIR}"

 

framework 工程搭建

原文:https://www.cnblogs.com/coolcold/p/11243355.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!