API 浏览器
Quasar CLI with Vite - @quasar/app-vite
发布到商店

所以,你已经完成了移动应用的开发。现在是时候部署它了。让我们学习如何操作。

¥So, you’ve finished working on your Mobile App. Now it’s time to deploy it. Let’s learn how.

Android 发布(Android Publishing)

¥Android Publishing

要生成 Android 的发布版本,我们可以使用以下 Quasar CLI 命令:

¥To generate a release build for Android, we can use the following Quasar CLI command:

$ quasar build -m cordova -T android
# or the short form:
$ quasar build -m android

这将根据 /src-cordova/config.xml 中的设置生成发布构建。

¥This will generate a release build based on the settings in your /src-cordova/config.xml.

接下来,我们可以在 “/src-cordova/platforms/android/app/build/outputs/apk/release” 或等效路径(终端输出中显示)找到未签名的 APK 文件。文件名通常以 “-release-unsigned.apk” 结尾。现在,我们需要对未签名的 APK 进行签名,并运行对齐实用程序来优化它,使其准备好上架应用商店。如果你已有签名密钥,请跳过这些步骤并使用原先的密钥。

¥Next, we can find our unsigned APK file in “/src-cordova/platforms/android/app/build/outputs/apk/release” or equivalent path (written in the output of terminal). Filename usually ends with “-release-unsigned.apk”. Now, we need to sign the unsigned APK and run an alignment utility on it to optimize it and prepare it for the app store. If you already have a signing key, skip these steps and use that one instead.

让我们使用 JDK 自带的 keytool 命令生成私钥。如果找不到此工具,请参阅安装指南:

¥Let’s generate our private key using the keytool command that comes with the JDK. If this tool isn’t found, refer to the installation guide:

$ keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 20000

首先,系统会提示你为密钥库创建密码。然后,回答该工具的其余问题,完成后,你应该在当前目录中创建一个名为 my-release-key.keystore 的文件。

¥You’ll first be prompted to create a password for the keystore. Then, answer the rest of the nice tool’s questions and when it’s all done, you should have a file called my-release-key.keystore created in the current directory.

危险

请确保将此文件保存在安全可靠的地方,如果丢失,你将无法向你的应用提交更新!

¥Make sure to save this file somewhere safe, if you lose it you won’t be able to submit updates to your app!

接下来,我们需要对 APK 进行压缩和签名。为此,我们使用了 Android SDK build-tools 文件夹中的一些应用,例如 /path/to/Android/Sdk/build-tools/VERSION/。例如,在安装了 Android Studio 的 OS X 上,zipalign 位于 ~/Library/Android/Sdk/build-tools/VERSION/ 中。

¥Next, we need to zip align and to sign the APK. For this we use a couple of applications that can be found in the Android SDK build-tools folder, something like /path/to/Android/Sdk/build-tools/VERSION/. For example, on OS X with Android Studio installed, zipalign is in ~/Library/Android/Sdk/build-tools/VERSION/.

要压缩对齐 APK:

¥To zip align the APK:

$ zipalign -v 4 <path-to-same-apk-file> HelloWorld.apk

要对 APK 进行签名:

¥To sign the APK:

apksigner sign --ks my-release-key.keystore --ks-key-alias alias_name <path-to-unsigned-apk-file>

现在我们有了最终发布的二进制文件 HelloWorld.apk,我们可以将其发布到 Google Play 商店,供全世界使用!

¥Now we have our final release binary called HelloWorld.apk and we can release this on the Google Play Store for all the world to enjoy!

(还有其他几种签名 APK 的方法。有关更多信息,请参阅官方 Android 应用签名文档。)

¥(There are a few other ways to sign APKs. Refer to the official Android App Signing documentation for more information.)

Google Play 商店(Google Play Store)

¥Google Play Store

现在我们已经为 Google Play 商店准备好了发布 APK,我们可以创建 Play 商店列表并上传我们的 APK 了。

¥Now that we have our release APK ready for the Google Play Store, we can create a Play Store listing and upload our APK.

首先,你需要访问 Google Play 商店开发者控制台 并创建一个新的开发者账户。遗憾的是,这并非免费。但是,与苹果的 99 美元相比,它的成本仅为 25 美元。

¥To start, you’ll need to visit the Google Play Store Developer Console and create a new developer account. Unfortunately, this is not free. However, the cost is only $25 compared to Apple’s $99.

拥有开发者账户后,你可以继续点击“在 Google Play 上发布 Android 应用”。

¥Once you have a developer account, you can go ahead and click “Publish an Android App on Google Play”.

然后,你可以继续点击按钮编辑商店列表(我们稍后会上传 APK)。你需要填写应用的描述。

¥Then, you can go ahead and click the button to edit the store listing (We will upload an APK later). You’ll want to fill out the description for the app.

准备就绪后,请上传用于发布版本的 APK 并发布列表。请耐心等待,你的辛勤工作一定会得到广泛应用!

¥When you are ready, upload the APK for the release build and publish the listing. Be patient and your hard work should be live in the wild!

更新你的应用(Updating your App)

¥Updating your App

在开发应用时,你需要定期更新它。

¥As you develop your app, you’ll want to update it periodically.

为了让 Google Play 商店接受更新的 APK,你需要升级应用版本(从 /package.json/quasar.config file > cordova > version 升级),然后重新构建应用以供发布。

¥In order for the Google Play Store to accept updated APKs, you’ll need to bump the app version (from /package.json or from /quasar.config file > cordova > version, then rebuild the app for release.

iOS 发布(iOS Publishing)

¥iOS Publishing

首先,你需要注册 Apple 开发者计划。与 Google 一样,如果你在 Apple 拥有个人账户,则可以为你的应用创建一个额外的账户。

¥First, you need to enroll in Apple Developer Program. As with Google, if you have a personal account with Apple, you can create an additional one for your applications.

将 Xcode 连接到你的开发者账户(Connecting Xcode with your developer account)

¥Connecting Xcode with your developer account

获得开发者身份后,请在 Mac 上打开 Xcode,然后前往“偏好设置”>“账户”。点击左下角的 + 按钮,将你的账户添加到 Xcode,然后按照说明操作。

¥After you receive your developer status, open Xcode on your Mac and go to Preferences > Accounts. Add your account to Xcode by clicking the + button on the lower left-hand side and follow the instructions.

签名(Signing)

¥Signing

现在你已将 Xcode 与你的开发者账户关联,请前往“偏好设置”>“账户”,在左侧选择你的 Apple ID,然后点击上图所示的“查看详细信息”按钮。

¥Now that you linked Xcode with your developer account, go to Preferences > Accounts, select your Apple Id on the left-hand side and then click the View Details button shown on the previous image.

点击“iOS 分发”选项旁边的“创建”按钮。

¥Click the Create button next to the iOS Distribution option.

你可以从官方文档中了解更多关于维护签名身份和证书的信息。

¥You can learn more about maintaining your signing identities and certificates from the official documentation.

设置应用标识符(Setting up the app identifier)

¥Setting up the app identifier

接下来,我们将通过 Apple 开发者会员中心设置应用 ID 标识符详细信息。标识符用于允许应用访问某些应用服务,例如 Apple Pay。你可以使用你的 Apple ID 和密码登录 Apple 开发者会员中心。

¥Next, through the Apple Developer Member Center we’ll set up the app ID identifier details. Identifiers are used to allow an app to have access to certain app services like for example Apple Pay. You can login to Apple Developer Member Center with your Apple ID and password.

登录后,你应该选择“证书、标识符和配置文件”选项。另请选择 iOS 应用下的“标识符”选项。然后选择 + 按钮以添加新的 iOS 应用 ID。

¥Once you’re logged in you should choose Certificates, Identifiers, and Profiles option. Also select the Identifiers option under the iOS Apps. Then select the + button in order to add a new iOS App ID.

然后,你需要设置应用名称,使用“Explicit App ID”选项,并将 Bundle ID 设置为 Cordova config.xml 标签中 id 的值。

¥Then you’ll have to set the name of your app, use the Explicit App ID option and set the Bundle ID to the value of the id in your Cordova config.xml tag.

此外,你还需要选择需要启用的服务。例如,如果你在应用中使用 Apple Pay 或 Wallet,则需要选择这些选项。

¥Additionally, you’ll have to choose any of the services that need to be enabled. For example, if you use Apple Pay or Wallet in your app, you need to choose those option.

你可以从 官方文档 了解更多关于注册应用标识符的信息。

¥You can learn more about registering app identifiers from the official documentation.

创建应用列表(Creating the app listing)

¥Creating the app listing

Apple 使用 iTunes Connect 来管理应用提交。登录后,你应该选择“我的应用”按钮,然后在下一个屏幕上选择 iTunes Connect“我的应用”标题下方的 + 按钮。

¥Apple uses iTunes Connect to manage app submissions. After your login, you should select the My Apps button, and on the next screen select the + button, just below the iTunes Connect My Apps header.

这将在下拉菜单中显示三个选项,你应该选择“新建应用”。之后,系统会弹出一个窗口,你需要选择应用名称、平台、主要语言、软件包 ID 和 SKU。

¥This will show three options in a dropdown, and you should select the New App. After this the popup appears where you have to choose the name of the application, platform, primary language, bundle ID and SKU.

完成后,点击“创建”按钮,你将看到一个屏幕,你需要设置一些基本选项,例如隐私政策 URL、类别和子类别。

¥Once you’re done, click on the Create button and you’ll be presented with a screen where you’ll have to set some basic options like Privacy Policy URL, category and sub category.

现在,在我们填写清单中的所有内容之前,我们将构建我们的应用并使用 Xcode 上传它。然后,你需要返回完成列表。

¥Now, before we fill out everything in the listing, we’ll build our app and get it uploaded with Xcode. Then you’ll come back to finish the listing.

你可以从 官方文档 了解更多关于在 iTunes Connect 中管理应用的信息。

¥You can learn more about managing your app in iTunes Connect from the official documentation.

生产环境构建应用(Building the app for production)

¥Building the app for production

$ quasar build -m cordova -T ios
# or the short form:
$ quasar build -m ios

# passing extra parameters and/or options to
# underlying "cordova" executable:
$ quasar build -m ios -- some params --and options --here

如果一切顺利,你将在控制台中看到 BUILD SUCCEEDED 的输出。

¥If everything went well you’ll see the BUILD SUCCEEDED output in the console.

在 Xcode 中打开项目(Opening the project in Xcode)

¥Opening the project in Xcode

现在,在 Xcode 中打开 /src-cordova/platforms/ios/<name>.xcodeproj 文件。如果下一步不起作用,你可能需要改用 <name>.xcworkspace

¥Now, open the /src-cordova/platforms/ios/<name>.xcodeproj file in Xcode. You may need to instead use <name>.xcworkspace if the next step doesn’t work.

Xcode 打开项目后,你应该会在常规视图中看到有关应用的详细信息。

¥Once the Xcode opens up the project, you should see the details about your app in the general view.

你只需检查 bundle identifier 是否设置正确,确保它与你之前在应用 ID 中指定的值相同即可。此外,请确保版本号和内部版本号正确。团队选项应设置为你的 Apple 开发者账户。在部署目标下,你可以选择应用将支持的设备。

¥You should just check that the bundle identifier is set up correctly, so that it’s the same as the value you specified earlier in the app ID. Also, make sure that the version and build numbers are correct. Team option should be set to your Apple developer account. Under the deployment target you can choose which devices your application will support.

创建应用存档(Creating an archive of the application)

¥Creating an archive of the application

在 Xcode 中,选择“产品”>“方案”>“编辑方案”以打开方案编辑器。接下来,从左侧列表中选择“存档”。确保“构建”配置已设置为“发布”。

¥In Xcode, select Product > Scheme > Edit Scheme to open the scheme editor. Next, select the Archive from the list on the left-hand side. Make sure that the Build configuration is set to Release.

要创建存档,请从项目编辑器的 Scheme 工具栏菜单中选择通用 iOS 设备,或者如果你的设备已连接到 Mac,则选择你的设备(如果选择了模拟器,则无法创建存档)。

¥To create an archive, choose a Generic iOS Device, or your device if it’s connected to your Mac (you can’t create an archive if simulator is selected), from the Scheme toolbar menu in the project editor.

接下来,选择“产品”>“存档”,存档管理器将出现并显示新的存档。(如果它产生错误,请返回上一步并打开 <name>.xcworkspace。)

¥Next, select Product > Archive, and the Archive organizer appears and displays the new archive. (If it produces an error instead, go back to the last step and open <name>.xcworkspace.)

此时,你可以点击 Upload to App Store... 按钮,如果一切顺利,你将获得一个已上传的应用,剩下唯一要做的就是完成 iTunes Connect 列表并提交审核!

¥At this point you can click the Upload to App Store... button, and if everything goes fine you’ll have an uploaded app, and the only thing that’s left to do is to complete the iTunes Connect listing and submit it for review!

此时,你应该会在上传包含内容的存档后不久收到来自 iTunes Connect 的电子邮件。

¥At this point you should get an email from iTunes Connect shortly after you uploaded the archive with the content.

完成应用列表流程(Finishing the app list process)

¥Finishing the app list process

现在你应该返回 iTunes Connect 门户并登录。接下来,点击左侧“APP STORE 信息”下的“价格和供货情况”。

¥Now you should head back to the iTunes Connect portal and login. Next, click on the Pricing and Availability on the left-hand side under APP STORE INFORMATION.

你不必担心忘记插入任何关于应用的关键和必需信息,因为如果你在所有详细信息填写完毕之前尝试提交应用进行审核,你将收到有关缺少哪些内容以及需要添加/更改哪些内容的通知。

¥You don’t have to worry about forgetting to insert any crucial and required information about your application, since you’ll be notified about what’s missing and what needs to be added/changed if you try to submit the app for review before all details are filled in.

接下来,点击左侧的“1.0 准备提交”按钮,如下图所示。上传存档时,iTunes Connect 会自动判断支持哪些设备尺寸。你需要为 iTunes Connect 检测到的每种应用大小上传至少一张屏幕截图。

¥Next, click on the 1.0 Prepare for Submission button on the left-hand side, as shown on the image below. When we uploaded our archive, iTunes Connect automatically determined which device sizes are supported. You’ll need to upload at least one screenshot image for each of the various app sizes that were detected by iTunes Connect.

接下来,你需要插入描述、关键词、支持 URL 和营销 URL(可选)。

¥Next, you’ll have to insert Description, Keywords, Support URL and Marketing URL (optionally).

在“构建”部分,你必须点击 + 按钮,并选择在前面步骤中通过 Xcode 上传的构建版本。

¥In the Build section you have to click on the + button and select the build that was uploaded through Xcode in the previous steps.

接下来,你需要上传图标、编辑评分,并设置一些其他信息,例如版权和你的个人信息。请注意,你在此处上传的图标尺寸必须为 1024 x 1024 像素。幸运的是,你可以使用第二个教程中的 splash.png。如果你是唯一的开发者,那么应用审核信息中的数据应该是你自己的。最后,作为最后一个选项,你可以保留默认勾选的选项,即一旦你的应用获得批准,它就会自动发布到 App Store。

¥Next, you’ll have to upload the icon, edit the rating, and set some additional info like copyright and your information. Note that the size of the icon that you’ll have to upload here will have to be 1024 by 1024 pixels. Thankfully, you can use the splash.png from the second tutorial. If you’re the sole developer then the data in the App Review Information should be your own. Finally, as the last option, you can leave the default checked option that once your app is approved that it is automatically released to the App Store.

现在我们已经完成了将所有详细信息添加到应用列表的操作,可以点击“保存”,然后“提交审核”。最后,你将看到最后一个需要填写的表单。

¥Now that we’re finished with adding all of the details to the app listing, we can press Save and then Submit for Review. Finally, you’ll be presented with the last form that you’ll have to fill out.

提交应用审核后,你会在“我的应用”中看到其状态为“等待审核”,如下图所示。此外,在你提交应用审核后不久,你会收到来自 iTunes Connect 的确认电子邮件,告知你应用正在审核中。

¥After you submit your app for review you’ll see the status of it in the My Apps as Waiting for review, as shown on the image below. Also, shortly after you submit your app for review you’ll get a confirmation email from iTunes Connect that your app is in review.

Apple 以其手动审核流程而自豪,这意味着你的应用审核可能需要几天时间。如果你的应用出现任何问题或状态更新,你将收到通知。

¥Apple prides itself with a manual review process, which basically means it can take several days for your app to be reviewed. You’ll be notified of any issues or updates to your app status.

更新应用(Updating the app)

¥Updating the app

由于你可能希望在某个时候更新你的应用,因此你首先需要升级应用版本(从 /package.json/quasar.config file > cordova > version 升级),然后重新构建应用以供发布。最后,你必须从 Xcode 打开它并重复相同的步骤。

¥Since you’ll probably want to update your app at some point you’ll first need to bump the app version (from /package.json or from /quasar.config file > cordova > version, then rebuild the app for release. Finally, you’ll have to open it up from the Xcode and follow the same steps all over again.

提交审核后,你将需要再次等待审核流程。

¥Once you submit for the review, you’ll have to wait for the review process again.