LoginSignup
94
88

More than 5 years have passed since last update.

xcodebuildでipa作成 -exportOptionsPlist対応版

Last updated at Posted at 2015-12-19

Xcode7.0までは、アーカイブからIPAファイルを作成するときはこのようにしてました。

xcodebuild -exportArchive -exportFormat ipa -archivePath ./Archive.xcarchive -exportPath Sample.ipa -exportProvisioningProfile 'XC: com.example'

でもXcode7.1以降でこのコマンド引数で実行すると、

-exportArchive without -exportOptionsPlist is deprecated

の表示がでるようになり、困ったことにこれで作ったipaファイルを altoolでiTunes Connectにバイナリをアップロードすると、以下のつれないお言葉が入ったメールが来てバイナリは弾かれるようになりました。
かならず弾かれるのか?、ほかの理由で弾かれるのか?まではわかりません。ちなみにエラーが来たアプリはObjective-CとSwiftの混在アプリです。

Dear developer,

We have discovered one or more issues with your recent delivery for "xxxxxxxx". To process your delivery, the following issues must be corrected:

Invalid Swift Support - The SwiftSupport folder is missing. Rebuild your app using the current public (GM) version of Xcode and resubmit it.

Once these issues have been corrected, you can then redeliver the corrected binary.

Regards,

The App Store team

もちろんベータ版のOSやXcodeは使っていません。
Xcodeで手作業でアーカイブしアップロードすると弾かれないので、先ほどの deprecatedが気になりますね。
よくみたら、exportArchiveexportOptionsPlistがないともうダメって書いてありました。ちゃんと読みましょう(苦笑)
というわけで、まじめに exportOptionsPlistを指定するようにします。
まずはヘルプで指定するplistの内容をチェックしてみます。なお以下は超意訳なので、間違っていたら指摘おねがいします。

xcodebuild -h
キー デフォルト値 対象 内容
method String "development" ALL エクスポートする形式。 app-store, ad-hoc, package, enterprise, development, developer-id
teamID String アーカイブ時のteamID ALL デベロッパポータルのteamを指定
uploadBitcode Bool true App Store パッケージがBitcodeを含む必要があるか?
uploadSymbols Bool true App Store パッケージにシンボルを含む必要があるか?
compileBitcode Bool true non-App Store Bitcodeから再コンパイルする必要があるか?
embedOnDemandResourcesAssetPacksInBundle Bool true non-App Store アプリ内のasset packを使用する場合は true、URLを指定してダウンロードする場合は false
onDemandResourcesAssetPacksBaseURL String "" non-App Store オンデマンドリソースを使用し、かつembedOnDemandResourcesAssetPacksInBundle が falseの場合、ダウンロードするasset packのURLを指定する
iCloudContainerEnvironment String Development non-App Store Production, Development
manifest Dictionary - non-App Store App Thinningのためのdistribution manifestを指定。ここを参照。キーは appURLdisplayImageURLfullSizeImageURL
thinning String none non-App Store インストール可能なデバイスを指定。 iPhone7,1 のように指定する。

これを踏まえて、iTunes Connectにアップロードするための最低限必要なplistを作ってみます。
(AdHocとかの場合には違う内容になりますので、注意してください。)

exportOptions.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>method</key>
    <string>app-store</string>
    <key>uploadBitcode</key>
    <false/>
    <key>uploadSymbols</key>
    <true/>
</dict>
</plist>

methodapp-storeで、uploadBitcodefalseuploadSymbolstrueにしています。

このplistを使ってipaを作ってみます。
(アーカイブのパスとかは環境によって変えてください)

xcodebuild -exportArchive -archivePath Archive.xcarchive -exportPath archive -exportOptionsPlist exportOptions.plist

これでarchiveディレクトリにプロジェクト名.ipaのファイルが作成されます。
実際にiTunes Connectにアップロードしてみます。

'/Applications/Xcode.app/Contents/Applications/Application Loader.app/Contents/Frameworks/ITunesSoftwareService.framework/Support/altool' --upload-app -f xxx.ipa  -u ${ITUNES_ID} -p ${ITUNES_PASS}

これでアップロード出来ると思います。
エラーメールが来なければOKです。
念のためアップロードが終わったらTestFlightで実機チェックしてみましょう。

94
88
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
94
88