xocodebulid 自动化打包 解决提示 ld: library not found for -lPods 问题

如果你的项目用到cocopod 第三方库。使用xcodebulid 估计会出现

 ld: library not found for -lPods

以下 是我的解决办法

xcodebuild -workspace 项目根目录/项目名.xcworkspace \

-scheme 项目名 \

ONLY_ACTIVE_ARCH=NO \

TARGETED_DEVICE_FAMILY=1 \

DEPLOYMENT_LOCATION=YES

 

重新运行命令。哈。成功了。

以下是我找到的解决方案

http://railsware.com/blog/2013/09/12/ios-integration-tests-with-appium/

http://testerhome.com/topics/151

 上面问题解决了。

运行命令 bulid 成功提示 可是 release 的app  却在~/Library/Developer/ugly_path/ 。。

如果能指定路径就好了

http://stackoverflow.com/questions/4233581/xcode-4-build-output-directory

http://blog.csdn.net/zb12345678/article/details/17607037

哈解决。。命令后添加参数 

CONFIGURATION_BUILD_DIR  ='指定路径',当前用户要有权限。如没有可以修改权限chomd 777 '指定路径'

如果每次都要自己输入命令 来打包 太麻烦了。何不把命令写成shell 用到时 拖到终端执行下 就ok 。岂不美哉

 xcode 新建。shell 文件

 

#!/bin/sh

#  ipa-build.sh
#  使用
#  把该文保存 ,修改权限chmod +x 你的shell文件名
#  把文件拖到 终端 。
#  参数 
# 1,你要打包工程的根目录 2,你要输出的ipa文件目录(你当前用户要有权限) 3,指定的ipa 文件名 参数用空格隔开
# eg:~

  # ~/Desktop/ipa-build.sh  ~/Documents/workSpace/project   ~/Desktop/project   projectName


#!/bin/bash


#参数判断
if [ $# != 3 ] && [ $# != 2 ]&& [ $# != 1 ];then
echo "Number of params error! Need three params!"
echo "1.path of project(necessary) 2.path of ipa dictionary(necessary) 3.name of ipa file(necessary)"
exit

elif [ ! -d $1 ];then
echo "Params Error!! The 1 param must be a project root dictionary."
exit
elif [ ! -d $2 ];then
echo "Params Error!! The 2 param must be a ipa dictionary."
exit
fi

#工程绝对路径
cd $1
project_path=$(pwd)
#build文件夹路径
build_path=${project_path}/build


#工程配置文件路径
project_name=$(ls | grep xcodeproj | awk -F.xcodeproj '{print $1}')
project_infoplist_path=${project_path}/${project_name}/${project_name}-Info.plist
#取版本号
bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" ${project_infoplist_path})
#取build值
bundleVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleVersion" ${project_infoplist_path})
#取bundle Identifier前缀
bundlePrefix=$(/usr/libexec/PlistBuddy -c "print CFBundleIdentifier" `find . -name "*-Info.plist"` | awk -F$ '{print $1}')




cd $project_path
#清理工程
xcodebuild clean || exit
#删除bulid目录
if  [ -d ${build_path} ];then
rm -rf ${build_path}
fi
#编译工程
xcodebuild  -configuration Release  -workspace ${project_path}/${project_name}.xcworkspace \
-scheme ${project_name} \
ONLY_ACTIVE_ARCH=NO \
TARGETED_DEVICE_FAMILY=1 \
DEPLOYMENT_LOCATION=YES CONFIGURATION_BUILD_DIR=${project_path}/build/Release-iphoneos  || exit



#IPA名称
if [ $# = 3 ];
then
ipa_name=$3
fi

if [ -d ./ipa-build ];then
rm -rf ipa-build
fi
#打包
cd $build_path
mkdir -p ipa-build/Payload
cp -r ./Release-iphoneos/*.app ./ipa-build/Payload/

cd ipa-build
zip -r ${ipa_name}.ipa *
cp -r ./${ipa_name}.ipa $2
rm -rf Payload
#删除bulid目录
if  [ -d ${build_path} ];then
rm -rf ${build_path}
fi 

受以下文章启发

http://webfrogs.me/2012/09/19/buildipa/

 有关xcodebulid

http://www.cnblogs.com/xiaodao/archive/2012/03/01/2375609.html

posted @ 2014-04-22 17:48  hhhker  阅读(10531)  评论(1编辑  收藏  举报