Before creating your application you will need to create the Distribution Certificate, Distribution Provisioning Profile and Firebase plist, and then send it to the Apple Store. Follow the tutorial below.
1 - Sign in with your Apple Developer account at: https://developer.apple.com/
2 - Click Certificates, Identifiers & Profiles
3 - Under Identifiers, click App IDs, on the upper right side click the + button to add a new App ID.
A - Enter the name of your app
B - Still on the same screen, when scrolling the page you must enter your Bundle ID for the app.
C - To find your Bundle ID you must go to the Site Manager, enter the mobile area and finally select the iOS option and copy the Bundle ID that appears.
D - Next to the Bundle ID on the Apple website, scroll down, and check the Push Notifications option, and click Continue.
4 - At the Apple Certificates, Identifiers & Profiles screen, click All in the left menu, and click the + button on the upper right.
A - Select App Store and Ad Hoc, and click Continue.
B - On the next screen you will need to select the cerSigningREquest.
C - The certSigningRequest of the App Store and Ad Hoc you must save in the site manager in the section of the mobile iOS, so it goes until the site manager right click on the Certificate Subscription Request and click on Save Link As, done this save You are ready to add it to the screen of the previous step.
D - After step 3.c, you will open the screen to download your iOS Distribution.
5 - You must generate the Production that will be used to configure your Firebase. To do this go to Production and click on the + button on the top right.
A - On the next screen select the Apple Push Notification service (Sandbox & Production) option and click continue.
B - You will then be prompted to select the App ID of your app that you have selected, then click Continue.
C - You will then be asked to select the .certSigningRequest, but this time you should select the certificate of your mac. For this you must access Keychain Access.
D - With Keychain Access open, click on the top bar in Keychain Access → Certificate Assistant → Request a Certificate From a Certificate Authority.
And - On the next screen you will have to enter your email, name and finally select the option Save to disk, and click continue to save to your mac.
F - After you have selected the certificate that you generated in the previous step, download Apple Push Services.
6 - You should now create your Mobile Provisioning Profiles by going to the Distribution menu in the left menu and clicking the + button.
A - Select App Store and click continue.
B - Select the App ID of your app and click Continue.
C - Next you need to select the certificate that you generated on step 4.
D - The next step is to enter the Profile Name, enter the name of your app for example, and click Continue.
e- Download the Provisioning profile.
7 - You should now create the .p12 file for the certificate that you created and downloaded in step 5. Click twice on the certificate that you downloaded in step 5 (aps.cer).
A - It will open a new screen of Keychain Access, you must right-click on your certificate that you just installed and select Export "Apple Push Services".
B - Save the p12 file to your Mac. In the next step you will be prompted to create a password (this step is very important because you will use this password to configure Firebase, we recommend that you enter an easy password), and after creating the password and confirmed on the Ok button, The password of your mac (used to login on your mac).
Performed all the previous steps, you will have the following .p12 file.
8 - After logging in and logging in to your google account, visit http://firebase.google.com and create your site design (or select it):
A - Select iOS
B - Enter the package code (this is the ID bundle of your app).
In order to get the bundle for your app, go to the builder app, select iOS build, and get the following info:
c- Click the 3 dots in your app's Firebase project, and click Settings.
D - From the top Settings menu, click Cloud Messaging, and the Production APNs Certificate and select your .p12 file that you created in step 7, you must enter the same password that you used to create your .p12.
e - The next step you should go back to the General of your Firebase projects, and download your .plist.
9 - Now that you have created all the certificates and Firebase just insert the files in the site manager and click Build Application.
B - After you finish building your app, download .ipa to submit your app to the Apple Store. With the download done, go to Itunes Connect: https://developer.apple.com/.
C - Click the + button to click New App, select iOS, fill in the Name, the language of your app, the Bundle Id of your app and the SKU (same as the Bundle ID), and click Create.
D - Access your Mac's Application Loader, and log in with your developer account.
e - Search your .ipa on your mac and send it through the application loader.
F - Go back to Itunes Connect, and fill in all the description, screenshot, etc pertaining to your app. When you click to submit your app in the Advertising Identifier section, select the Serve advertisements within the app option, and accept the term.