20

I have a jenkins instance that does a release build using xcodebuild. I then have a script (on Jenkins) to create the .ipa file using xcrun. this worked fine for us until now. Now we have a watchkit app and the .ipa file that is created from this process is not the same as the one that is created if you do an archive build and export it from Xcode.

The exported .ipa from Xcode has a 'Payload' folder, a 'Symbols' folder (probably optional) and a 'WatchKitSupport' folder. The ipa generated from the xcrun doesnt have the 'Symbols' or the 'WatchKitSupport' folder. See more about the structure here : https://stackoverflow.com/a/29400301/327386

I saw this post on SO : https://stackoverflow.com/a/19856005/327386 that has commands to archive and export the .ipa build (similar to the Xcode process) but even that didn't create the new folders in question.

Does anyone know if there is a way to use the command line tools to create an .ipa file that is equivalent to the one created by Xcode? I didn't find any official documentation on this

Community
  • 1
  • 1
RPM
  • 3,426
  • 2
  • 27
  • 35
  • 1
    I filed a bug with Apple for the fact that the command line tools dont generate the same ipa file that Xcode does and they marked that bug as a duplicate. The original one is still open – RPM Apr 15 '15 at 21:09
  • 2
    Could you link to the original bug please? – Maciej Trybiło May 01 '15 at 10:35
  • I agree with you, I'm seeing the same results here. I've even tried `xcodebuild -exportArchive -exportFormat ipa -archivePath App.xcarchive -exportPath App -exportWithOriginalSigningIdentity` – danieljimenez May 02 '15 at 19:16
  • What's your xcrun script look like? I had problems similar to you just to make a cordova build into an `.ipa` for an iOS app so this may not work, but perhaps try this: `xcrun -sdk iphoneos PackageApplication -v Abczyx.app -o /Users/myname/Desktop` where you are in the `.app` file directory and outputting it to your `/Users/myname/Desktop` location. – jojo May 06 '15 at 21:35
  • use this above command at your own risk. it just deleted all my desktop, without permission. I am so pissed. – Karan Kumar May 07 '15 at 09:06
  • 1
    @RPM do you have the Radar ID of the original one? – danieljimenez May 07 '15 at 18:52
  • Please check below link, may be it help. [Xcode “Build and Archive” from command line][1] [1]: http://stackoverflow.com/questions/2664885/xcode-build-and-archive-from-command-line – Rajesh Maurya Jun 15 '15 at 08:49

2 Answers2

6

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.
Community
  • 1
  • 1
Szabó Csaba
  • 861
  • 8
  • 9
1

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.

Mani Kandan
  • 629
  • 4
  • 12