[英]Error building custom iOS Framework in Xcode
這是我第一次嘗試創建自定義iOS框架。 我正在嘗試按照本教程使用xCode創建自定義iOS Framework。 我已經完成了最后一步(步驟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轉儲。
預先感謝您的幫助。
這是要使用的正確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}"
如果您仍有任何疑問,可以查看視頻教程 。
您沒有為兩者編譯iOSBundle(步驟10)並直接嘗試合並iOS模擬器和設備(步驟12)。
基本上步驟10正在做什么? 它只是為模擬器和設備創建框架,因此由於某種原因,您的構建文件夾變空,並且您的腳本無法找到iOS-Simulator和Device的框架或任何一個。
快速解決:在步驟12之前再執行一次步驟10,這將創建iOS模擬器框架和設備框架,在為Aggregate方案構建項目之后,這將合並兩個框架。
您可以在下面找到所有三個(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 /
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.