xcodebuild无法从终端构建但是从xcode成功

Asa*_*sen 5 xcode sh xcodebuild xcode6 ios8

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

xcodebuild -project <projName> -scheme <schemeName>  -configuration Debug clean build 
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

CodeSign error: entitlements are required for product type 'Framework' in SDK 'Simulator - iOS 8.0'. Your Xcode installation may be damaged.
Run Code Online (Sandbox Code Playgroud)

并且构建无法完成.它在日志的最后说

The following build commands failed:
PhaseScriptExecution Run\ Script build/myProj.build/Debug-iphoneos/myScheme.build/Script-DB9DC5BB19740464002F9181.sh
Run Code Online (Sandbox Code Playgroud)


升级:


失败的脚本是:

   #!/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
Run Code Online (Sandbox Code Playgroud)


有谁知道我做错了什么?
任何帮助都非常感激

Asa*_*sen 14

我找到了答案.
由于自定义框架仅在iOS 8中宣布,-sdk iphonesimulator8.0 需要添加到脚本中,它定义Xcode仅为Ios 8构建项目.
它应该如下所示:

xcodebuild -project <projName> -scheme <schemeName> -sdk iphonesimulator8.0 -configuration Debug clean build
Run Code Online (Sandbox Code Playgroud)

这段代码有效