Flutter packages ios and submits it to App Store for review

Set up a Flutter development environment on macOS.
Preparation work: Apple developer account, iPhone, Mac (or Mac virtual machine)
• Go to the Flutter official website to download the latest available installation package and go to the download page.
• After the download is complete, unzip the installation package to the directory you want to install. I installed it to the application directory.
• Configure environment variables:

  1. Open (or create) a file.
vim ~/.bash_profile
  1. Due to restrictions on domestic users, Flutter officially provides images, add the following environment variables to the user environment variables, and enter i to start editing:
  export PUB_HOSTED_URL=https://pub.flutter-io.cn
  export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn
  1. Add the flutter path to path:
 export PATH=`pwd`/flutter/bin:$PATH

Insert image description here
4. Enter: wq to save, and press esc to exit. Run the following command to refresh the current terminal window:

source ~/.bash_profile

• Install Xcode and download it through the Xcode download link and app store. The author downloaded Xcode13.2.1 (I installed version 13.3 at the beginning, and it ran normally when the simulator was running, but an error occurred when archiving. I later reinstalled version 13.2.1, and the archive was successful). Since there are compatibility issues between the macOS system and the Xcode version, you can install the corresponding Xcode version according to the prompts.
• Run command to check dependencies:

flutter doctor

Insert image description here

• Install the ios simulator and find the simulator using the following command:

  open -a Simulator

• Run the command to start your application:

  flutter run

If the run fails with an error, follow the prompts to resolve the issue.
Package ios and install it on a real machine for testing.
Since the author is using a virtual Mac and cannot connect the phone to Xcode, I cannot install the development version for real machine debugging. I can only package the release version and upload it to the distribution platform (the author is using Dandelion, you can Choose by yourself), install it on your mobile phone and test it.
• Register a Bundle ID

  1. Open the App IDs of the developer account and click Identifiers + Create a Bundle ID.
  2. Select App IDs and click Continue to proceed to the next step.

Insert image description here

  1. Enter the application name; select Explicit Bundle ID, and then enter an ID. This needs to be named carefully, because this content is directly related to your program and needs to be used in many places. It is best to be in the format of com.yourcompany.yourappname, such as com .ydisk.ios; Select the service your application will use; click Continue to proceed to the next step.

    Insert image description here

  2. On the next page, confirm the details and click Register to register your Bundle ID.
    • Register the app on App Store Connect

  3. Open App Store Connect in your browser.

  4. On the iTunes Connect login page, click My Apps**.

  5. Click the + in the upper left corner of the My App page and select New App.

  6. Fill in your application details. In the Platforms section, make sure iOS is selected. Since Flutter does not currently support tvOS, please leave this checkbox unchecked. Click Create.

  7. Navigate to your app’s application details, App Information .

  8. In the General Information section, select the package ID you registered in the previous step.
    • Apply for a certificate

  9. Open Keychain Access, click Certificate Assistant, and select Request a certificate from a certification authority.
    Insert image description here

  10. Enter the appropriate information and click Continue.

    Insert image description here

  11. Click Certificates +, select iOS Distribution, and click Continue to proceed to the next step.

Insert image description here

  1. Select the CSR file you just created, which is the certificate signing request file, upload it, and click Continue to generate the certificate.

Insert image description here

  1. Click to download and double-click to install. At this time, the installed certificate can be seen in the certificate in the keychain.
    • Apply for the Provisioning Profile corresponding to the certificate
  2. Select Ad Hoc, click Continue, and proceed to the next step.

Insert image description here

  1. Select the corresponding App ID and click Continue to proceed to the next step.

Insert image description here

  1. Select the corresponding certificate, select the previously created publishing certificate, and click Continue to proceed to the next step.

Insert image description here

  1. Select the device to install. Because the author has added devices before, you can directly select and add them here. If not, you need to copy the udid of the real device and add it to Devices. This step is not included in the release of the Provisioning Profile file.

    Insert image description here

  2. Enter the Provisioning Profile Name and click Generdate to generate the file.

Insert image description here

• Xcode project settings

  1. In Xcode, open Runner.xcworkspace in the ios folder in your project directory.
  2. To view your app's settings, select the Runner project in the Xcode project navigator. Then, in the main view sidebar, select TARGETS Runner.
  3. Select the General tab. Next, you will verify the most important settings:
    Identity section:
    • Display Name: The name of the application to be displayed on the home screen and elsewhere.
    • Bundle Identifier: The App ID you registered on App Store Connect.
    • Version: The user-facing version number you wish to release.
    • Build: A unique build number used to track this version on iTunes Connect. Each upload requires a unique build number.

    Insert image description here

Build Settings section:
• Code Signing Identity: Select the appropriate certificate.

Insert image description here

Signing & Capabilities section:
• Automatically manage signing: Whether Xcode should automatically manage the application, the default setting is true.
• Team: Select the team associated with your registered Apple Developer account.
• Provisioning Profile: Click the drop-down list, click Download Profile, and select the previously created Provisioning Profile file.
• Signing Certificate: Automatically filled in when selecting the Provisioning Profile file.

Insert image description here

• Xcode archive

  1. Run the flutter packaging command to create a release version.
 flutter build ios --release
  1. Select Product > Archive to generate a build archive. If Archive is disabled, you can select Any iOS Device (note: when performing this step, you must execute the flutter command packaging in the first step, otherwise an error will be reported). After the build is successful, the following interface will pop up. Click the Distribute App button on the right. Go to the next step.
    Insert image description here

  2. Select Ad Hoc and click Next to proceed.

Insert image description here

  1. Click Export, select the save location, and export the folder.

Insert image description here

Insert image description here

  1. Upload the exported ipa package to the Dandelion distribution platform. After the upload is completed, a page with a QR code will appear. Use the UDID device added to the Apple development account to scan the QR code and install it on the device for testing.
    Submit the application to the App Store for review and release
    • Apply for the App Store file of the Provisioning Profile and the production of the Ad Hoc certificate, which will not be described in detail here.

    Insert image description here

• Select the App Store file that you just applied for Provisioning Profile on Xcode to package and archive it.
• Once the build is successful, choose Submit to App Store Connect.
• Open App Store Connect in a browser, you can see all built versions, select the application to upload, fill in the application-related information, and finally submit it for review.
Note: The author has a personal developer account. The above screenshots may be different from those of enterprise developer accounts.
Original article: Privately deployed Yueku enterprise network disk technology - Geng Xiaoting

Guess you like

Origin blog.csdn.net/Yuku226/article/details/131410416