[英]How to use a custom framework in an iOS project?
I've searched various websites for a solution to this problem, and haven't found one which actually works for me. 我在各种网站上搜索了针对该问题的解决方案,但没有找到一个对我有效的解决方案。
What I have is a custom framework, which shows up as follows in Xcode's Derived Data
folder: 我拥有的是一个自定义框架,该框架在Xcode的
Derived Data
文件夹中显示如下:
As you can see, it's a universal
framework. 如您所见,这是一个
universal
框架。 From my understanding, this means, that it can be used for actual iOS Devices and Simulator alike. 据我了解,这意味着它可以用于实际的iOS设备 和 模拟器 。
In order to generate the universal
framework, I got the following run script from some tutorial, which I can't recall: 为了生成
universal
框架,我从一些教程中得到了以下运行脚本,我不记得了:
#CONFIG=${CONFIGURATION}
CONFIG=Release
# Step 1.
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIG}-universal
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 2.
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIG} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="$BUILD_ROOT" clean build
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIG} -sdk iphonesimulator -arch x86_64 -arch i386 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="$BUILD_ROOT" clean build
# Step 3.
cp -R "${BUILD_DIR}/${CONFIG}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"
cp -R "${BUILD_DIR}/${CONFIG}-iphonesimulator/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule/}" "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/Modules/${PROJECT_NAME}.swiftmodule"
# Step 4.
lipo -create -output "${UNIVERSAL_OUTPUTFOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIG}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIG}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}"
So now I have LanguageKit.framework
. 所以现在我有了
LanguageKit.framework
。
I want to use this framework in a single view application. 我想在单个视图应用程序中使用此框架。
How would I go about including the framework in the project? 我将如何将框架包括在项目中?
You have to perform following: 您必须执行以下操作:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.