[iOS]Xcode升级到Xcode9,xcodebuild -exportArchive导出ipa文件exportOptionsPlist

2017年12月09日 iOS 6条评论 阅读2679次

[iOS]Xcode升级到Xcode9,xcodebuild -exportArchive导出ipa文件exportOptionsPlist


之前做的打包ipa用的shell文件,好久没使用了,今天拿出来看看还好用不。
由于Xcode的版本升级,现在已经是Xcode9了,之前Xcode7下的命令还确实发生问题了。


问题:xcrun中PackageApplication不再可用

较老版本的打包ipa命令中我们经常是xcodebuild + xcrun 配合,先生成xcarchive,在导出为ipa,但现在使用xcrun 后有了这个错误:

xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH


网上说现在新版本的Xcode已经删除PackageApplication了,PackageApplication在前几个版本已被废弃,从Xcode8.3开始彻底删除了。

相应的对策:在旧版本的Xcode的/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/下能找到PackageApplication这个文件,可以复制这个文件到当前使用的Xcode相应目录下,或从网上下载该文件。然后执行命令:



sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
chmod +x /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/PackageApplication

苹果已经删除的东西最好还是不要继续使用了,接下来探索新的方法。

在终端中输入xcodebuild -help之后


xcodebuild-help.png

xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
       xcodebuild [-project <projectname>] -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
       xcodebuild -workspace <workspacename> -scheme <schemeName> [-destination <destinationspecifier>]... [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [-showBuildSettings] [<buildsetting>=<value>]... [<buildaction>]...
       xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]
       xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]] [-json]
       xcodebuild -showsdks
       xcodebuild -exportArchive -archivePath <xcarchivepath> -exportPath <destinationpath> -exportOptionsPlist <plistpath>
       xcodebuild -exportLocalizations -localizationPath <path> -project <projectname> [-exportLanguage <targetlanguage>...]
       xcodebuild -importLocalizations -localizationPath <path> -project <projectname>



发现有xcodebuild -exportArchive -archivePath <xcarchivepath> -exportPath <destinationpath> -exportOptionsPlist <plistpath>的一个命令

根据提示配置即可,值得注意的是最后一个exportOptionsPlist参数。

exportOptionsPlist没从苹果官网上找到相关资料,好在全网中有前辈已经探出一条路来,用网上提供的plist文件,出现了各种各样错误。
听说自己手动在Xcode9中Archive并且导出一次,在保存ipa的文件夹下,除ipa文件之外,还有两个plist文件,其中ExportOptions.plist就是命令行参数中需要指定的plist文件。

这里把我的plist文件放上,需要时可以直接修改里面的几个参数就能用了。


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>compileBitcode</key>
    <false/>
    <key>method</key>
    <string>enterprise</string>
    <key>provisioningProfiles</key>
    <dict>
        <key>net.jileniao.app【应用BundleID】</key>
        <string>net.jileniao.app_dis【描述文件名称】</string>
    </dict>
    <key>signingCertificate</key>
    <string>iPhone Distribution</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>H1PWD0G6DA</string>
    <key>thinning</key>
    <string>&lt;none&gt;</string>
</dict>
</plist>


这样,最后把我的整个shell文件贴出来。



#!/bin/bash
#Author jileniao.net
SCHEMENAME='JILENIAO.NET'
DATE=`date +%Y%m%d_%H%M`
SOURCEPATH=$( cd "$( dirname $0 )" && pwd)
IPAPATH=$SOURCEPATH
DISNAME=$SCHEMENAME"_"$DATE
ARCHNAME=$DISNAME.xcarchive
IPANAME=$DISNAME
#rm -rf ./build
#构建
xcodebuild archive \
 -project JILENIAO.NET.xcodeproj \
 -scheme JILENIAO.NET \
 -configuration Release \
 -archivePath $ARCHNAME \
 clean \
 build \
 -derivedDataPath ./
if [ -e $ARCHNAME ]; then
  echo "xcodebuild archive Successful"
else
  echo "xcodebuild archive Failed"
  exit 1
fi
#生成ipa
xcodebuild -exportArchive \
 -archivePath $ARCHNAME \
 -exportPath $IPANAME \
 -exportOptionsPlist ./ExportOptions.plist
if [ -e $IPANAME ]; then
  echo "Export ipa Successful"
  open $IPAPATH
else
  echo "Export ipa Failed"
fi







分享本文至:

WRITTEN BY

avatar
本文标签:XCodexcodebuild
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

6 条评论

  1. avatar instanalo

    <a href="http://www.georgesherry.com/new-york-yankees-hat-gang-weatherproof-hata">new york yankees hat gang weatherproof</a> <a href="http://www.jenalgroup.com/purple-gold-mens-nike-zoom-all-out-shoes-runninge">purple gold mens nike zoom all out shoes</a> <a href="http://www.badacamshotel.com/nike-classic-cortez-nylon-gray-bianca-schuhea">nike classic cortez nylon gray bianca</a> <a href="http://www.compressmyjs.com/nike-foamposite-one-r%C3%B8d-metalleic-scarpeb">nike foamposite one r酶d metalleic</a> <a href="http://www.fetison.com/womens-nike-huarache-utility-black-denmark-shoeso">womens nike huarache utility black denmark</a> <a href="http://www.neffloot.com/adidas-pr%C3%B8dator-incurza-sports-direct-kurpesc">adidas pr酶dator incurza sports direct</a>
    instanalo http://www.instanalo.com/

  2. avatar mylinkstv

    <a href="http://www.rellthewolf.com/kvinners-new-balance-360-s%C3%B8lv-kurpesb">kvinners new balance 360 s酶lv</a> <a href="http://www.fincasagaro.com/cheap-pink-pumas-zapatost">cheap pink pumas</a> <a href="http://www.mushigiftpack.com/white-leather-converse-shoesz">white leather converse</a> <a href="http://www.glplawyers.com/nike-air-max-1-anthracite-wolf-grigio-schuheb">nike air max 1 anthracite wolf grigio</a> <a href="http://www.canditatenext.com/nike-limited-chris-carson-jersey-32-nfl-seattle-seahawks-rush-fashion-womens-white-pink-nflu">nike limited chris carson jersey 32 nfl seattle seahawks rush fashion womens white pink</a> <a href="http://www.ganuocdua.com/nike-roshe-one-hi-skou">nike roshe one hi</a>
    mylinkstv http://www.mylinkstv.com/

  3. avatar golfbodyshop

    <a href="http://www.dianaandwill.com/paul-george-2016-s%C3%B8lv-hvit-scarpeb">paul george 2016 s酶lv hvit</a> <a href="http://www.newagecharger.com/womens-nike-air-max-bw-white-netherlands-shoeso">womens nike air max bw white netherlands</a> <a href="http://www.foliekopen.com/femminile-nike-free-tr-fit-gituttio-viola-kurpesb">femminile nike free tr fit gituttio viola</a> <a href="http://www.milapioffret.com/cool-jordan-shoes-names-zapatost">cool jordan shoes names</a> <a href="http://www.kalraslan.com/white-leather-converse-shoesz">white leather converse</a> <a href="http://www.umuttekelbayi.com/jordan-5-schwarz-wei%C3%9F-grau-schuheb">jordan 5 schwarz wei脽 grau</a>
    golfbodyshop http://www.golfbodyshop.com/

  4. avatar alistauction

    <a href="http://www.kbowendesign.com/lunarglide-6-gr%C3%B8nn-quarters-kurpesf">lunarglide 6 gr酶nn quarters</a> <a href="http://www.naifenma.com/mennns-big-pony-polo-gr%C3%A5-marinen-polou">mennns big pony polo gr氓 marinen</a> <a href="http://www.nowosadko.com/salomon-xt-hornet-herre-gul-scarpeb">salomon xt hornet herre gul</a> <a href="http://www.sdsremote.com/jim-mcmahon-navy-blue-nike-nfl-chicago-bears-t-shirt-name-number-logo-9-nfls">jim mcmahon navy blue nike nfl chicago bears t shirt name number logo 9</a> <a href="http://www.advitil.com/air-jordan-aero-mania-bleu-blanc-scarpeg">air jordan aero mania bleu blanc</a> <a href="http://www.cutlaroc.com/flyknit-lunar-2-l%C3%B8b-sko-obuvd">flyknit lunar 2 l酶b sko</a>
    alistauction http://www.alistauction.com/

  5. avatar n1jvmtjv

    <a href="http://www.33ocbhxx.com/nike-air-jordan-8-retro-schwarz-chrome-for-verkauf-obuvb">nike air jordan 8 retro schwarz chrome for verkauf</a> <a href="http://www.ou5cxgy0.com/air-jordan-11-retro-zapatillas-kurpesa">air jordan 11 retro zapatillas</a> <a href="http://www.5m9w6ysn.com/a-buon-mercato-nike-free-5.0-v2-nero-bianca-butyc">a buon mercato nike free 5.0 v2 nero bianca</a> <a href="http://www.6iqdfvgi.com/adidas-springblade-razor-noir-butye">adidas springblade razor noir</a> <a href="http://www.nfnl51ta.com/nike-free-run-blau-kurpesd">nike free run blau</a> <a href="http://www.p4vepcy8.com/jordan-3-sort-cem%C3%A6ndt-online-schuhea">jordan 3 sort cem忙ndt online</a>
    [url=http://www.n1jvmtjv.com/]n1jvmtjv[/url]

  6. avatar juliemobley

    <a href="http://www.truenthusiast.com/game-al-woods-jersey-tennessee-titans-96-alternate-navy-blue-nflb">game al woods jersey tennessee titans 96 alternate navy blue</a> <a href="http://www.nrthofhere.com/jordan-12-red-october-gamma-skoc">jordan 12 red october gamma</a> <a href="http://www.ksjfifgmif.com/burberry-womens-cashmere-scarf-scarfr">burberry womens cashmere scarf</a> <a href="http://www.gbwpvqyg.com/bon-march%C3%A9-nike-air-max-95-hommes-jaune-sneakerc">bon march茅 nike air max 95 hommes jaune</a> <a href="http://www.alannacaldas.com/zx-flux-multicolor-prisms-shoesc">zx flux multicolor prisms</a> <a href="http://www.lmbaidu.com/ray-ban-aviator-polarized-lenses-sunglassesr">ray ban aviator polarized lenses</a>
    juliemobley http://www.juliemobley.com/

欢迎留言




用户登录

sitemap