Testing with Testflight
Testflight allows you to invite users to beta test your apps before they are available on the App store. This guide will walk you through the details of submitting an app that can be tested and invite users to test your app.
Step 1: Create an App Record in App Store Connect
Open App Store Connect and log in with your Apple ID. Open the Apps section to manage your App Records. Click the add button (+), select “New App”, and choose iOS as the platform, as shown here.

Note that the SKU simply needs to be a number that is greater than 1 digit and is not used by another App.
Step 2: Find your Bundle ID and Version number
Also, your Bundle ID + Bundle Suffix must be unique and match the bundle ID in Xcode and your version number must also match the one in Xcode. You can check the bundle ID and version of your App by clicking on your project in the far left Project Navigator window as shown here:

Step 3: Set an Icon
You cannot submit your App for testing without at least one icon image for your App. Add an icon for the default as shown here:

You can use a site like Makeappicon to construct images of all the useful dimensions for you.
Step 4: Archive and Submit
We need to archive the app, validate it, and then submit it so that a build of it will show up in App Store Connect. First, switch the build target to iOS Device. Then, select the Product | Archive menu option, which will bring up the Archive Organizer. Click on the “Validate…” button, which will start a process that may run for up to 15 minutes. (Sometimes this hangs for some reason so if it runs longer than 15 minutes you may want to cancel it and run again). If you did not have any validation errors you will now be able to submit your App to App Store Connect. Click on the “Submit…” button and wait again. (If you had any errors in Validation you will not be able to submit and must fix those and then perform Validation again)

Note: the screenshots in the remaining steps show an older App Store Connect design; the section and button names in the text reflect the current layout.
Step 5: Add Users to Your Team
If you need to add new users to your project go to the Users and Access section of App Store Connect (this section was previously named “Users and Roles”). Then follow the wizard. Note that the email needs to be the user’s Apple ID.

Step 6: Add Internal Testers
Go to the Apps section of App Store Connect and select your App. Then open the TestFlight tab and, in the sidebar, click the add button (+) next to Internal Testing to create a testing group. On the group’s page, click Invite Testers and select the team members you would like to test your App.

Step 7: Distribute a Build to Your Testers
Add your uploaded build to the internal group with the Add Builds button (or select “Enable automatic distribution” when creating the group to have every new build delivered automatically). Once a build is available to the group, the testers you selected are invited by email.

Step 8: Users Accept Invitation
The users will get an email and can use the link in the email to automatically be taken to the App Store to get TestFlight or if they already have TestFlight it will open up TestFlight and allow them to install the new App for testing. Note that the users need to open the email in the native iOS email client, opening up in GMail or other apps won’t allow the user to download your App to test.