这是我第一次尝试创建自定义iOS框架。我正在尝试使用xCode创建自定义iOS框架,方法是遵循此tutorial。我已经完成了最后一步(步骤12)。
Step 12: Build Project with Aggregate scheme
Select Aggregate("UniversaliOS") Scheme
Select iOS device
Build Project (⌘-B)
但是构建失败并出现Shell脚本调用错误:命令/ bin / sh失败,退出代码为1.错误详细信息为:
ditto: can't get real path for source
lipo: can't create temporary output file: /Users/pdl/Library/Developer/Xcode/DerivedData/InnerID-iOS-SDK-dgyjuudeootshidhpzlejhbyqvco/Build/Products/InnerID-iOS-SDK-Bundle.framework/InnerID-iOS-SDK-Bundle.lipo (No such file or directory)
Command /bin/sh failed with exit code 1
我完全不知道现在要做什么。有什么建议?如有必要,我可以提供PhaseScriptExecution转储。
提前感谢您的帮助。
答案 0 :(得分:2)
这是要使用的正确shell脚本(对于swift)。
CONFIG=Release
# Step 1. Make sure the output directory exists
UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIG}-universal
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"
# Step 2. Build Device and Simulator versions
codebuild -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. Copy the framework structure to the universal folder. Subsequently copy the files of the swiftmodule (in Modules directory) of -iphonesimulator to the swiftmodule of universal framework directory.
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. Create universal binary file using lipo and place the combined executable in the copied framework directory
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}"
如果您仍有任何疑问,可以查看video tutorial。
答案 1 :(得分:0)
您没有为两者编译iOSBundle(步骤10)并直接尝试合并iOS模拟器和设备(步骤12)。
基本上第10步是做什么的? 它只是为模拟器和设备创建框架,因此由于某种原因,您的构建文件夹变空,并且您的脚本无法找到iOS-Simulator和Device的框架或任何一个。
快速解决: 在步骤12之前再执行一次步骤10,这将创建iOS模拟器框架和设备框架,在为Aggregate方案构建项目之后,这将合并两个框架。
您可以在下面找到所有三个(iOS-Simulaor,Device,Merged)框架 /用户/ jaym /库/开发商/ Xcode中/ DerivedData / iOSFramework-doeqysadgntrrlguuvcivuhapnlr /建造/产品/
在您的情况下,/ Users / pdl / Library / Developer / Xcode / DerivedData / InnerID-iOS-SDK-dgyjuudeootshidhpzlejhbyqvco / Build / Products /