5

我知道如何在 Xcode 5 中创建框架。但是在 Xcode 6 中,如何结合模拟器框架和设备框架?当我尝试合并时,出现代码签名错误。当我使用lipo结合这两个框架时,我也得到一个错误。

错误: Command /bin/sh failed with exit code 65

4

2 回答 2

16

我在 xcode6 中创建通用框架的解决方案。

尝试以下步骤:

第1步:

File—> 
    New —> 
       Project —> 
           Framework & Library —> 
               Next —> 
                      Product Name

第 2 步:创建自定义类文件

第 3 步

Target -> 
       Build phase -> 
           Headers, 

将所有头文件公开。现在构建模拟器和设备。

第4步:

File ->
    New ->
           Target ->
               iOS ->
                      Other -> 
                          Aggrigate ->somename eg: framework

第 5 步:

From Targets —> 
    Custom aggregate target(Eg: Framework)—> 
           Build Phase—> 
               Add Run script

第 6 步:shell code在运行脚本中添加以下内容

///

UNIVERSAL_OUTPUTFOLDER=${BUILD_DIR}/${CONFIGURATION}-universal

# make sure the output directory exists
mkdir -p "${UNIVERSAL_OUTPUTFOLDER}"

# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos  BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build

# Step 2. Copy the framework structure to the universal folder
cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUTFOLDER}/"

# Step 3. 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}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}"

第 7 步:

Goto active scheme —> 
    Custom aggregate —> 
           Build

第 8 步:现在在 Xcode 中的产品中右键单击框架并单击在 finder 中显示。

检查“Debug-universal”文件夹并获取通用框架。

于 2014-12-04T13:11:30.553 回答
0

代替

xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator -arch x86_64 BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build

xcodebuild -target "${PROJECT_NAME}" -configuration ${CONFIGURATION} -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build

干净的构建

于 2016-07-21T10:45:24.440 回答