To use any of the distribution methods, you first create an archive of your app. An archive is a build of your app, including debugging information, that Xcode stores in a bundle.
In the main window of your Xcode project, choose a target and a build-only device or real device from the Scheme toolbar menu. If the target is a simulator, you can’t create an archive. Then, choose Product > Archive to build the target, and create the archive that will appear in the Archives organizer.
You can open the Archives organizer directly by choosing Window > Organizer. If you want to confirm your app is ready to submit to TestFlight or the App Store without submitting it yet, select your archive and then click Validate App. Xcode will perform a limited, automated initial validation of the app and provide feedback.