How to generate .ipa file from command line with watchkit app How to generate .ipa file from command line with watchkit app xcode xcode

How to generate .ipa file from command line with watchkit app


Exact problem

xcodebuild -exportArchive cannot make valid IPA with Watch Extension, it's an Apple bug (http://openradar.appspot.com/20898925).

Official (Xcode 7) solution

Apple solved this problem in Xcode 7 with the -exportOptionsPlist flag of the xcodebuild -exportArchive command. You can find more details about it in this article.

Not-official (Xcode 6) solutions

There are workarounds for the problem. If it's urgent then you can play with them, but I couldn't find a workaround which was working for everybody (based on forum discussions).

  1. Adding WatchKitSupport and Symbols folders. More details here and here. It was not working for me.
  2. Resigning the whole application. More details here. It's hacky, but working better than the previously mentioned solution.


I too faced the same issue. The command line tool exportArchive misses the required Watchkit support folders while exporting the archive to ipa. I tried figured it out using the below shell script.

https://gist.github.com/phatblat/6eb8895e2202f796960e

You can call the above shellscript from your Jenkins buildscript like below.

<exec executable="/bin/bash" failonerror="true">            <arg value="${root.dir}/buildscripts/package-ida.sh" />            <arg value="${build.dir}/APP_NAME.xcarchive" />            <arg value="${build.dir}/APP_NAME.ipa" />        </exec>

Now You will be able to see the WatchKit support folder in your ipa payload and your appstore app validation will also get succeeded using the generated Jenkins build.