Xcode static library into a dynamic library, merge multiple libraries

Used cocoapods the use_frameworks! After option, we need component or third-party library support dynamic Framework, otherwise it can not be integrated. Our own components yet a good deal, will modify Xcode project configuration file, or build a new dynamic Framework project, will pull in the code, recompile export it.

But third-party libraries how should we deal with it? Many times we get just compiled after the .a file or .framework,

Static libraries packaged into a Framework

Note: As the only third-party libraries packaged into a Framework, do not do the extra work package.

step 1

Create a Framework Project

Git: https://gitlab.qianbaocard.org/iOS-modules/function/lib
name: WL + third-party library name
Step 2

Deploy code

The third-party code Lib folder dragged into the project
folder all the header files dragged into the project Headers file
Step 3

Project Configuration

General-> DeploymentTarget-> 8.0
BuildSettings-> OtherLinkerFlags -> - ObjC
add tripartite libraries needed to configure
BuildPhases-> Headers-> all the header files dragged into Public
Step 4

Adding a script (for merging Release, iPhoneSimulator)
BuildPhases-> RunScript

if [ “${ACTION}” = “build” ]
then
INSTALL_DIR=${SRCROOT}/Products/${PROJECT_NAME}.framework
DEVICE_DIR=${BUILD_ROOT}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework
SIMULATOR_DIR=${BUILD_ROOT}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework
if [ -d “${INSTALL_DIR}” ]
then
rm -rf “${INSTALL_DIR}”
fi
mkdir -p “${INSTALL_DIR}”
cp -R “${DEVICE_DIR}/“ “${INSTALL_DIR}/“

#ditto “${DEVICE_DIR}/Headers” “${INSTALL_DIR}/Headers”
lipo -create “${DEVICE_DIR}/${PROJECT_NAME}” “${SIMULATOR_DIR}/${PROJECT_NAME}” -output “${INSTALL_DIR}/${PROJECT_NAME}”

#open “${DEVICE_DIR}”

#open "$ {} SRCROOT / Products's"
Fi
Step 5

Compile

Select again run the simulator
selection device running again
Step 6

Written Pod

s.vendored_frameworks=’Products/*.framework’
完成

Original: Big Box  Xcode static library into a dynamic library, merge multiple libraries


Guess you like

Origin www.cnblogs.com/petewell/p/11611654.html