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

2017年12月09日 iOS 9条评论 阅读4783次

[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
看了本文是不是觉得很赞,那就赶紧点击下面按钮分享给身边的朋友吧!

9 条评论

  1. avatar rozfile

    <a href="http://www.homesbyted.com/nike-free-3.0-v4-sort-orange-skok">nike free 3.0 v4 sort orange</a> <a href="http://www.jserrahockey.com/adidas-john-walle-2-dark-blau-wei%C3%9F-schuheh">adidas john walle 2 dark blau wei脽</a> <a href="http://www.djibzphoto.com/adidas-crazylight-boost-2.5-yellow-shoesk">adidas crazylight boost 2.5 yellow</a> <a href="http://www.vfcholdings.com/nike-kobe-xi-r%C3%B8d-deep-bl%C3%A5-skol">nike kobe xi r酶d deep bl氓</a> <a href="http://www.biancawalkden.com/rosa-and-lilla-converse-obuvk">rosa and lilla converse</a> <a href="http://www.sportinboston.com/nike-shox-turbo-vi-sl-grigio-scarpei">nike shox turbo vi sl grigio</a>
    rozfile http://www.rozfile.com/

  2. avatar smfamilylaw

    <a href="http://www.kafsabimoradi.com/adidas-gazelle-bl%C3%A5-gull-obuvk">adidas gazelle bl氓 gull</a> <a href="http://www.henryglegg.com/adidas-yeezy-750-boost-blu-scarpei">adidas yeezy 750 boost blu</a> <a href="http://www.theillitches.com/nike-mercurial-electric-verde-zapatosh">nike mercurial electric verde</a> <a href="http://www.thomsank.com/kvinder-nike-zoom-train-action-sort-gr%C3%A5-lyser%C3%B8d-skok">kvinder nike zoom train action sort gr氓 lyser酶d</a> <a href="http://www.youdaanl.com/nike-lunar-force-1-duckboot-svart-dark-loden-obuvi">nike lunar force 1 duckboot svart dark loden</a> <a href="http://www.sactopalooza.com/nike-mercurical-victory-vi-tf-p%C3%BArpura-naranja-negro-cleats-zapatosl">nike mercurical victory vi tf p煤rpura naranja negro cleats</a>
    smfamilylaw http://www.smfamilylaw.com/

  3. avatar xaviersarrate

    <a href="http://www.dbievents.com/adidas-originals-shoes-green-shoesj">adidas originals shoes green</a> <a href="http://www.ilankocaeli.com/new-era-wooly-hats-hatk">new era wooly hats</a> <a href="http://www.msignworx.com/herre-nike-air-max-95-bl%C3%A5-r%C3%B8d-skoj">herre nike air max 95 bl氓 r酶d</a> <a href="http://www.dianegrams.com/ralph-lauren-woven-bag-poloh">ralph lauren woven bag</a> <a href="http://www.jobstodayng.com/adidas-superstar-black-leopard-shoesi">adidas superstar black leopard</a> <a href="http://www.hardcoreboris.com/adidas-originals-eqt-support-adv-grigio-scarpej">adidas originals eqt support adv grigio</a>
    xaviersarrate http://www.xaviersarrate.com/

  4. avatar imagimp

    <a href="http://www.teamdalarna.com/kvinners-nike-air-huarache-gul-svart-obuvi">kvinners nike air huarache gul svart</a> <a href="http://www.syairshamyoun.com/nike-dunk-high-hombres-amarillo-zapatosp">nike dunk high hombres amarillo</a> <a href="http://www.fizalisfresh.com/coach-megan-black-sunglasses-coachh">coach megan black sunglasses</a> <a href="http://www.fsscas.com/nike-zoom-structure-18-womens-orange-yellow-shoesj">nike zoom structure 18 womens orange yellow</a> <a href="http://www.imagimp.com/adidas-ultra-boost-lilla-lyser%C3%B8d-skol">adidas ultra boost lilla lyser酶d</a> <a href="http://www.burmamaritime.com/femmes-nike-lebron-12-oranger-gris-chaussuresq">femmes nike lebron 12 oranger gris</a>
    imagimp http://www.imagimp.com/

  5. avatar uffelfinn

    <a href="http://www.synthcourses.com/asics-gel-lyte-v-for-venta-nj-schuheb">asics gel lyte v for venta nj</a> <a href="http://www.talentbschool.com/adidas-zx-700-gituttio-arancia-chaussurese">adidas zx 700 gituttio arancia</a> <a href="http://www.chatavalanche.com/nike-roshe-run-hommes-noir-and-noir-butyg">nike roshe run hommes noir and noir</a> <a href="http://www.demuslimah.com/adidas-superstar-bianca-dam-scarpea">adidas superstar bianca dam</a> <a href="http://www.getbizbuilder.com/nike-kobe-11-flyknit-marr%C3%B3n-naranja-schuheb">nike kobe 11 flyknit marr贸n naranja</a> <a href="http://www.harveenandraj.com/nike-air-max-bw-femmes-blanc-rose-vert-butyf">nike air max bw femmes blanc rose vert</a>
    uffelfinn http://www.uffelfinn.com/

  6. avatar interfaithstewards

    <a href="http://www.thenewfolk.net/nike-mercurial-vapor-ix-fg-arancia-schwarz-kurpesa">nike mercurial vapor ix fg arancia schwarz</a> <a href="http://www.thepathseries.net/nike-air-max-thea-flyknit-gr%C3%BCn-hills-schuhed">nike air max thea flyknit gr眉n hills</a> <a href="http://www.therailers.net/air-jordan-1-mid-blanco-true-rojo-light-sail-kurpesb">air jordan 1 mid blanco true rojo light sail</a> <a href="http://www.thesixwaysofatheism.net/zx-flux-grigio-viola-kurpesa">zx flux grigio viola</a> <a href="http://www.thesmfoundation.net/mennns-asics-asics-gel-kinsei-2-oransje-obuvb">mennns asics asics gel kinsei 2 oransje</a> <a href="http://www.tigm.net/nike-free-flyknit-5.0-mujeres-negro-oro-kurpesa">nike free flyknit 5.0 mujeres negro oro</a>
    interfaithstewards http://www.interfaithstewards.net/

  7. avatar michiganev

    <a href="http://www.townyplay.com/robinson-cano-jersey-nfli">robinson cano jersey</a> <a href="http://www.djpunjabii.com/air-jordan-cp3-ix-gr%C3%A5-mint-gr%C3%B8nn-obuvk">air jordan cp3 ix gr氓 mint gr酶nn</a> <a href="http://www.avsomurie.com/coach-poppy-op-art-medium-white-crossbody-bags-coachh">coach poppy op art medium white crossbody bags</a> <a href="http://www.circusveil.com/adidas-15.3-turf-argento-verde-scarpej">adidas 15.3 turf argento verde</a> <a href="http://www.laconiaoil.com/nike-air-max-90-hyp-qs-blu-scarpei">nike air max 90 hyp qs blu</a> <a href="http://www.hurizmir.com/new-orleans-pelicans-knit-hath">new orleans pelicans knit</a>
    michiganev http://www.michiganev.com/

  8. avatar graciecomm

    <a href="http://www.xescortx.com/nike-magista-onda-arancia-scarpej">nike magista onda arancia</a> <a href="http://www.naturabottega.com/femminile-nike-air-max-270-blu-scarpei">femminile nike air max 270 blu</a> <a href="http://www.peddlir.com/nikki-bella-wwe-classic-clean-up-cap-hath">nikki bella wwe classic clean up cap</a> <a href="http://www.snowdaydc.com/neon-rose-nike-air-max-chaussuresh">neon rose nike air max</a> <a href="http://www.alliesindex.com/nike-lunarglide-7-rouge-gris-chaussuresj">nike lunarglide 7 rouge gris</a> <a href="http://www.cafekem.com/converse-chuck-taylor-alle-star-classic-wei%C3%9F-schuhek">converse chuck taylor alle star classic wei脽</a>
    [url=http://www.graciecomm.com/]graciecomm[/url]

  9. avatar gregnovak

    <a href="http://www.epointsclub.com/nike-womens-seth-roberts-game-white-road-jersey-oakland-raiders-nfl-10-nflz">nike womens seth roberts game white road jersey oakland raiders nfl 10</a> <a href="http://www.hiphoprapjam.com/jordan-size-us14-us15-gelb-gr%C3%BCn-obuvd">jordan size us14 us15 gelb gr眉n</a> <a href="http://www.inanaktar.com/femminile-nike-air-presto-grigio-oro-scarpec">femminile nike air presto grigio oro</a> <a href="http://www.pdxwoof.com/nike-cortez-rosa-zebra-kurpesb">nike cortez rosa zebra</a> <a href="http://www.uncwliving.com/nfl-yannick-ngakoue-womens-blackcamo-91-jacksonville-jaguars-nike-salute-to-service-t-shirt-nflr">nfl yannick ngakoue womens blackcamo 91 jacksonville jaguars nike salute to service t shirt</a> <a href="http://www.wonkytrax.com/nike-air-max-thea-mujeres-verde-gris-butyg">nike air max thea mujeres verde gris</a>
    gregnovak http://www.gregnovak.com/

欢迎留言




用户登录

sitemap