0

这是我第一次尝试创建自定义 iOS 框架。我正在尝试按照本教程使用 xCode 创建自定义 iOS 框架。我已经走到了最后一步(第 12 步)。

Step 12: Build Project with Aggregate scheme

Select Aggregate("UniversaliOS") Scheme 
Select iOS device
Build Project (⌘-B) 

但构建失败并出现 Shell Script Invocation Error: Command /bin/sh failed with exit code 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 转储。

预先感谢您的帮助。

4

2 回答 2

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

如果还有疑问,可以看视频教程

于 2015-03-26T13:26:56.453 回答
0

您没有为两者编译 iOSBundle(第 10 步),而是直接尝试合并 iOS 模拟器和设备(第 12 步)。

基本上第 10 步在做什么?它只是为模拟器和设备创建框架,因此由于某种原因,您的构建文件夹为空,并且您的脚本无法找到适用于 iOS 模拟器和设备两者或任何一个的框架。

快速解决:执行第 10 步,在第 12 步之前再执行一次,这将创建 iOS 模拟器框架和设备框架,然后为您的聚合方案构建项目,这将合并两个框架。

您可以在下面找到所有三个(iOS-Simulaor、Device、Merged)框架/Users/jaym/Library/Developer/Xcode/DerivedData/iOSFramework-doeqysadgntrrlguuvcivuhapnlr/Build/Products/

在您的情况下, /Users/pdl/Library/Developer/Xcode/DerivedData/InnerID-iOS-SDK-dgyjuudeootshidhpzlejhbyqvco/Build/Products/

于 2013-10-21T01:58:15.880 回答