为了方便使用,我在GitHub上创建了模版工程,执行脚本一步即可创建私有的framework。仓库地址
这篇文章主要讲述如何创建自己的framework,并提交到pod管理供他人使用。
1、新建framework项目xxModule
新建工程,选择Framework,然后命名为xxModule
设置xxModule的build settings
Build Activity Architecture Only = YES
Installation Directiotory 删除路径
iOS Deployment Target = iOS 9.0
Skip Install = YES
Strip Debug Symbols During Copy = YES //Debug = NO
Enable Bitcode = NO
Mach-O Type = Static Library
2、新建framework的Demo与Aggregate
在TARGETS列表下点击加号,添加Single View App,命名为xxModuleDemo。选择xxModuleDemo->General,将xxModule.framework添加至Frameworks,Liberaries,and Embedded Content。并设置Demo
Enable Bitcode = NO
在TARGETS列表下点击加号,添加Aggregate,命名为xxModuleAggregate。选择xxModuleAggregate->Build Phases中加入shell脚本:
# Type a script or drag a script file from your workspace to insert its path.
if [ "${ACTION}" = "build" ]
then
INSTALL_DIR=${
SRCROOT}/Products/${
PROJECT_NAME}.framework
DEVICE_DIR=$