Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24565] iOS CLI: Improve the way dist-appstore build works

GitHub Issuen/a
TypeImprovement
PriorityCritical
StatusClosed
ResolutionFixed
Resolution Date2017-04-14T21:38:17.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.1.0
ComponentsCLI
Labelscli, ios, titanium, xcode8.3
ReporterUriel Lizama
AssigneeChris Barber
Created2017-04-07T14:20:56.000+0000
Updated2017-05-09T23:04:31.000+0000

Description

First some background. I created [TiFastlane](https://github.com/ulizama/TiFastlane) as a way to be able to use [Fastlane](https://fastlane.tools/) with Titanium development. To be able to use Fastlane when archiving a build it needs to be into an .ipa archive, the way I used to do that is by a small hack, using dist-adhoc with an App Store profile. This worked until XCode 8.3 in which the Legacy API was disabled. This puts me in the current situation to which I need some assistance. The way I'm looking to solve it is to:

Create the .archive: appc run -p ios -T dist-appstore

Use the XCode exporter to export the archive into an ipa xcodebuild -exportArchive -archivePath "~/Library/Developer/Xcode/Archives/2017-04-06/My App 2017-04-06 10-24-57.xcarchive" -exportPath "./dist" -exportOptionsPlist "./build/iphone/Info.plist"

I tested this manually and it works, but there are some issues I'm encountering to be able to have this work as real CLI option. *Missing method export option in the plist* The plist generated by the CLI is missing the method, which then has xcodebuild fail when doing the export because it defaults to development so the code signing is wrong. To fix this the correct method needs to be present in the plist:
<key>method</key>
<string>app-store</string>
This issue doesn't happen on 6.0.1.GA, only in the latest version. *XCode Archiver Launch* The other issue is that when the dist-appstore build finishes, it automatically tries to launch the XCode archive manager. This makes it necessary to have an extra human intervention in the step, which breaks the whole automatic process. It would be great if we could have a way to override that feature, so that when the build finishes it doesn't do anything else. I'm more than willing to help out in doing changes or tests on the CLI to achieve this, but this is my first time hacking the Ti CLI so I'm a bit lost on what goes where. Aside from these fixes, it might be worth it to add a --export-ipa option on the build process so that the CLI automatically does the second step of calling the exporter so we end up with an ipa ready to use for the App Store.

Comments

  1. Hans Knöchel 2017-04-10

    For the missing method, couldn't you just add it in [here](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/commands/_build.js#L3781) by checking the deployment-target and do something like plist.method = "app-store" (or what ever target is selected). For the Archiver launch, does --build-only not work? Thanks!
  2. Uriel Lizama 2017-04-10

    PR: https://github.com/appcelerator/titanium_mobile/pull/8954
  3. Chris Barber 2017-04-14

    6_1_X backport: https://github.com/appcelerator/titanium_mobile/pull/8966
  4. Abir Mukherjee 2017-05-09

    Node Version: 6.10.1 NPM Version: 3.10.10 Mac OS: 10.12.4 Appc CLI: 6.2.0 Appc CLI NPM: 4.2.9 Titanium SDK version: 6.1.0.v20170509114242 Appcelerator Studio, build: 4.8.1.201612050850 Xcode 8.3.2 Tested with the above environment. I first created an app, and built to the app-store with
       appc run -p ios -T dist-appstore
       
    XCode launched and opened the archive manager. I then tried:
       appc run -p ios -T dist-appstore --output-dir ~/Desktop
       
    In this case a .ipa file was created on the Desktop, and XCode did not launch. This is expected behavior.

JSON Source