# How to deploy to iTunes Connect TestFlight?

**URL:** <https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780>\
**Category:** iOS\
**Tags:** deploy, testflight\
**Created:** [February 14, 2017, 2:50pm UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780 "2017-02-14T14:50:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [February 14, 2017, 2:50pm UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780/1 "2017-02-14T14:50:56Z")

</div>

To auto deploy to iTunes Connect TestFlight:

1. Add the **Deploy to iTunes Connect / TestFlight (with Deliver)** or the **Deploy to iTunes Connect / TestFlight (with Shenzhen)** step to your workflow, after the **Xcode Archive** or **Xamarin Archive** step (once the signed IPA is available, so if you use a Sign or Re-sign step to sign the IPA you should add the deploy step after that), and specify your iTunes Connect login credentials for the **Deploy to iTunes Connect / TestFlight …** step (preferably through Secret Environment Variables).
  - _In general the **Deliver** tool based step is probably better, as it’s more up to date and supports more features, but it uses a reverse engineered iTunes Connect API, which might break when Apple changes it. That said the Fastlane guys (who are the developers of the deliver tool) are quite quick to adapt to these changes. **Shenzhen** uses Xcode tools, but it supports only the basics of TestFlight submission (uploading the IPA)._

2. Make sure that the app (`.ipa`) is signed for **App Store** distribution, as iTunes Connect only supports that.
  - If you use the **Xcode Archive** or **Export … Xcode archive** step to generate the signed IPA, all you have to do is to set the **Select method for export** input of the step to **app-store**. _If you use a different Team ID for app store signing than the one you do regular signing with, you also have to set the **The Developer Portal team to use for this export** option, but if you use the same team this is not required._
  - And of course don’t forget to upload the required app store code signing files ([code signing docs](http://devcenter.bitrise.io/ios/code-signing/)).

3. It might be a good idea to auto set the build number to the `BITRISE_BUILD_NUMBER`, as iTunes Connect requires a unique build number for every upload.

That’s all!

An example configuration (used for one of our sample apps we test iTunes Connect TestFlight submissions with):

```auto
---
format_version: 1.3.1
default_step_lib_source: https://github.com/bitrise-io/bitrise-steplib.git
app:
  envs:
  - BITRISE_PROJECT_PATH: "./Bitrise-iTunesConnectBetaTest/Bitrise-iTunesConnectBetaTest.xcodeproj"
  - BITRISE_SCHEME: Bitrise-iTunesConnectBetaTest
  - INFO_PLIST_PATH: "./Bitrise-iTunesConnectBetaTest/Bitrise-iTunesConnectBetaTest/Info.plist"
trigger_map:
- push_branch: "*"
  workflow: deploy-to-test-flight
workflows:
  deploy-to-test-flight:
    steps:
    - activate-ssh-key@3.1.1:
        run_if: '{{getenv "SSH_RSA_PRIVATE_KEY" | ne ""}}'
    - git-clone@3.4.1: {}
    - certificate-and-profile-installer: {}
    - set-xcode-build-number:
        title: Set Build Number
        inputs:
        - plist_path: "$INFO_PLIST_PATH"
    - xcode-archive:
        title: Archive for App Store
        inputs:
        - export_method: app-store
    - deploy-to-itunesconnect-deliver:
        inputs:
        - itunescon_user: "$ITUNES_CONNECT_USER"
        - password: "$ITUNES_CONNECT_PASSWORD"
        - app_id: "$ITUNES_CONNECT_APP_ID"
        - team_name: "$ITUNES_CONNECT_TEAM_NAME"
    - deploy-to-bitrise-io:
        run_if: 
        inputs:
        - notify_user_groups: none
        - notify_email_list: ''

```

Note if you want to use this configuration: don’t forget to specify the following environment variables, preferably as Secret Environment Variables:

- `ITUNES_CONNECT_USER`
- `ITUNES_CONNECT_PASSWORD`
- `ITUNES_CONNECT_APP_ID`
- `ITUNES_CONNECT_TEAM_NAME`

If you have any questions, just let us know!

Happy Building! 🙂

---

<div class="post-metadata">

**Author:** ![alejandro\_chacin](https://avatars.discourse-cdn.com/v4/letter/a/e480ec/32.png) [@alejandro\_chacin](https://discuss.bitrise.io/u/alejandro_chacin)\
**Post date:** [April 20, 2017, 6:00am UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780/2 "2017-04-20T06:00:54Z")

</div>

Thanks for a great walkthrough! -  
Where can I auto set the BITRISE\_BUILD\_NUMBER ?

---

<div class="post-metadata">

**Author:** ![viktorbenei](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/viktorbenei/32/18_2.png) [@viktorbenei](https://discuss.bitrise.io/u/viktorbenei)\
**Post date:** [April 20, 2017, 9:53am UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780/3 "2017-04-20T09:53:14Z")

</div>

> [@alejandro\_chacin](#):
>
> Where can I auto set the BITRISE\_BUILD\_NUMBER ?

@alejandro_chacin You can use the **Set Xcode Project Build Number** step for that.

Related discussions (with more info/details):

> [@Example of "Set Xcode Project Build Number" step](http://discuss.bitrise.io/t/example-of-set-xcode-project-build-number-step/1369):
>
> Hi, can you give me an example of “Build Number Offset” and “Version Increment” of “Set Xcode Project Build Number” step that is maintained by you guys. Also, is it possible to increment build and version numbers in this step?

> [@Automatic build numbering](http://discuss.bitrise.io/t/automatic-build-numbering/584):
>
> How do I get Bitrise to autonumber my builds?

---

<div class="post-metadata">

**Author:** ![ifnull](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/ifnull/32/3167_2.png) [@ifnull](https://discuss.bitrise.io/u/ifnull)\
**Post date:** [October 15, 2018, 6:07pm UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780/4 "2018-10-15T18:07:57Z")

</div>

Has this step been renamed? I only see “Deploy to iTunes Connect” and “Deploy to iTunes Connect - Application Loader”. I’m not clear on the difference between those two either.

---

<div class="post-metadata">

**Author:** ![bitce](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/bitce/32/1639_2.png) [@bitce](https://discuss.bitrise.io/u/bitce)\
**Post date:** [October 18, 2018, 1:48pm UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780/5 "2018-10-18T13:48:02Z")

</div>

Hi @danielsmith_deutsch! The step was indeed renamed, or rather replaced, the difference between the current ones is that the [Application Loader](https://github.com/bitrise-steplib/steps-deploy-to-itunesconnect-application-loader) one uses Apple’s official solution by the same name, while other [Deploy to iTunes](https://github.com/bitrise-io/steps-deploy-to-itunesconnect-deliver) step uses Fastlane’s deliver action.

---

<div class="post-metadata">

**Author:** ![andoanakqa](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@andoanakqa](https://discuss.bitrise.io/u/andoanakqa)\
**Post date:** [February 21, 2019, 4:26pm UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780/6 "2019-02-21T16:26:09Z")

</div>

@viktorbenei, how are you handling Apple’s MFA use case?

---

<div class="post-metadata">

**Author:** ![bitce](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/bitce/32/1639_2.png) [@bitce](https://discuss.bitrise.io/u/bitce)\
**Post date:** [February 22, 2019, 9:24am UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780/7 "2019-02-22T09:24:07Z")

</div>

@andoanakqa we’re recommending using App-specific passwords to surpass Two Factor Authentication. These can be created [here](https://appleid.apple.com/).

---

<div class="post-metadata">

**Author:** ![ryanam6480](https://avatars.discourse-cdn.com/v4/letter/r/d78d45/32.png) [@ryanam6480](https://discuss.bitrise.io/u/ryanam6480)\
**Post date:** [August 7, 2020, 5:33pm UTC](https://discuss.bitrise.io/t/how-to-deploy-to-itunes-connect-testflight/780/8 "2020-08-07T17:33:51Z")

</div>

Hi @bitce is there a way I can dynamically set the :

- `ITUNES_CONNECT_USER`
- `ITUNES_CONNECT_PASSWORD`
- `ITUNES_CONNECT_APP_ID`
- `ITUNES_CONNECT_TEAM_NAME`

For example, I have a few clients all with different creds, and Id like to dynamically push through bitrise based on the different clients without having to add it in every time? I collect this info from the clients.

Thanks
