xcodebuild无法从终端进行构建,但是从xcode成功进行了构建 [英] xcodebuild fails to build from terminal but succeeded from xcode

查看:130
本文介绍了xcodebuild无法从终端进行构建,但是从xcode成功进行了构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用xcode 6-beta 3构建框架 使用xcode编译时,它可以工作,但是使用以下命令从终端编译时:

I'm trying to build a framework using xcode 6-beta 3 when compiling it using xcode it works but when compiling it from a terminal with the command:

xcodebuild -project <projName> -scheme <schemeName>  -configuration Debug clean build 

我遇到以下错误

CodeSign error: entitlements are required for product type 'Framework' in SDK 'Simulator - iOS 8.0'. Your Xcode installation may be damaged.

,并且构建无法完成. 在日志末尾显示

and the build fails to complete. at the end of the log it says

The following build commands failed:
PhaseScriptExecution Run\ Script build/myProj.build/Debug-iphoneos/myScheme.build/Script-DB9DC5BB19740464002F9181.sh


升级:


失败的脚本是:


the script that failed is :

   #!/bin/sh 
# Config 
UFW_TARGET=AppCore

# Default build dir
UFW_BUILD_DIR="./build"

# Global vars
if [ -z ${SDK_NAME} ]; then

# Use the latest iphoneos SDK available
UFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o "iphoneos.*$")
while read -r line; do
UFW_SDK_VERSION="${line}"
done <<< "${UFW_GREP_RESULT}"
else

# Use the SDK specified by XCode
UFW_SDK_VERSION="${SDK_NAME}"
fi

UFW_SDK_VERSION=$(echo "${UFW_SDK_VERSION}" | grep -o "[0-9].*$")

UFW_IPHONE_DIR="${UFW_BUILD_DIR}/${CONFIGURATION}-iphoneos"
UFW_SIMULATOR_DIR="${UFW_BUILD_DIR}/${CONFIGURATION}-iphonesimulator"
UFW_UNIVERSAL_DIR="${UFW_BUILD_DIR}/${CONFIGURATION}-universal"

# Static lib name
STATIC_LIB_NAME="appCore"
UFW_FRAMEWORK_DIR="${STATIC_LIB_NAME}.framework"

# Build Framework

rm -rf ${UFW_UNIVERSAL_DIR}

xcodebuild ARCHS="armv7 armv7s arm64" -target "${UFW_TARGET}" -configuration ${CONFIGURATION} -sdk iphoneos${UFW_SDK_VERSION} clean build RUN_CLANG_STATIC_ANALYZER=NO

if [ "$?" != "0" ]; then echo >&2 "Error: xcodebuild failed"; exit 1; fi

xcodebuild ARCHS="i386 x86_64" -target "${UFW_TARGET}" -configuration ${CONFIGURATION} -sdk iphonesimulator${UFW_SDK_VERSION} clean build RUN_CLANG_STATIC_ANALYZER=NO

if [ "$?" != "0" ]; then echo >&2 "Error: xcodebuild failed"; exit 1; fi

mkdir -p "${UFW_UNIVERSAL_DIR}"
mkdir -p "${UFW_UNIVERSAL_DIR}/${UFW_FRAMEWORK_DIR}"
mkdir -p "${UFW_UNIVERSAL_DIR}/${UFW_FRAMEWORK_DIR}/Headers"

cp -a "${UFW_IPHONE_DIR}/${UFW_FRAMEWORK_DIR}/Headers" "${UFW_UNIVERSAL_DIR}/${UFW_FRAMEWORK_DIR}"

echo "running lipo -create -ouput..."
lipo -create -output "${UFW_UNIVERSAL_DIR}/${UFW_FRAMEWORK_DIR}/${STATIC_LIB_NAME}" "${UFW_IPHONE_DIR}/${UFW_FRAMEWORK_DIR}/${STATIC_LIB_NAME}" "${UFW_SIMULATOR_DIR}/${UFW_FRAMEWORK_DIR}/${STATIC_LIB_NAME}"
if [ "$?" != "0" ]; then echo >&2 "Error: lipo failed for ${STATIC_LIB_NAME}"; exit 1; fi


有人知道我在做什么错吗?
任何帮助将不胜感激


Does anyone know what I'm doing wrong ?
any help be much appreciated

推荐答案

我找到了答案.
由于自定义框架仅在iOS 8中宣布,因此需要将-sdk iphonesimulator8.0添加到脚本中,它定义了Xcode以仅针对Ios 8构建项目.
它应该看起来像:

I have found an answer.
Since custom frameworks were announced only in iOS 8, -sdk iphonesimulator8.0 need to be added to the script, it defines Xcode to build the project only for Ios 8.
it should look like:

xcodebuild -project <projName> -scheme <schemeName> -sdk iphonesimulator8.0 -configuration Debug clean build

此代码有效

这篇关于xcodebuild无法从终端进行构建,但是从xcode成功进行了构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆