distributing-tauri-for-ios

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Distributing Tauri Apps for iOS

将Tauri应用分发至iOS平台

This skill covers the complete process of distributing Tauri v2 applications to Apple's iOS App Store.
本指南涵盖了将Tauri v2应用分发至苹果iOS App Store的完整流程。

Prerequisites

前置条件

Before distributing a Tauri iOS app, ensure:
  1. macOS development machine (required for iOS builds)
  2. Xcode installed with iOS SDK
  3. Apple Developer Program enrollment ($99/year)
  4. Tauri project initialized for iOS (
    tauri ios init
    )
在分发Tauri iOS应用前,请确保满足以下条件:
  1. macOS开发机器(iOS构建必需)
  2. 安装了iOS SDK的Xcode
  3. Apple Developer Program注册(年费99美元)
  4. 已为iOS初始化Tauri项目(
    tauri ios init

Apple Developer Program Enrollment

Apple Developer计划注册

  1. Sign in with Apple ID
  2. Accept the Apple Developer Agreement
  3. Complete enrollment (individual or organization)
  4. Wait for approval (typically 24-48 hours)
前往developer.apple.com/programs完成注册:
  1. 使用Apple ID登录
  2. 接受Apple Developer协议
  3. 完成注册流程(个人或企业账号均可)
  4. 等待审核通过(通常需要24-48小时)

Bundle Identifier Configuration

Bundle Identifier配置

The bundle identifier must be unique and match across all configurations.
Bundle Identifier必须唯一,且在所有配置中保持一致。

tauri.conf.json

tauri.conf.json

json
{
  "identifier": "com.yourcompany.yourapp",
  "version": "1.0.0",
  "bundle": {
    "iOS": {
      "bundleVersion": "1"
    }
  }
}
Configuration notes:
  • identifier
    : Reverse-domain format, must match App Store Connect
  • version
    : Becomes
    CFBundleShortVersionString
    (user-visible version)
  • bundleVersion
    : Becomes
    CFBundleVersion
    (build number, must increment for each upload)
json
{
  "identifier": "com.yourcompany.yourapp",
  "version": "1.0.0",
  "bundle": {
    "iOS": {
      "bundleVersion": "1"
    }
  }
}
配置说明:
  • identifier
    : 反向域名格式,必须与App Store Connect中的配置完全匹配
  • version
    : 对应
    CFBundleShortVersionString
    (用户可见的版本号)
  • bundleVersion
    : 对应
    CFBundleVersion
    (构建号,每次上传必须递增)

Register Bundle ID in App Store Connect

在App Store Connect中注册Bundle ID

  1. Go to Certificates, Identifiers & Profiles
  2. Click "+" to register a new identifier
  3. Select "App IDs" then "App"
  4. Enter description and explicit Bundle ID matching
    tauri.conf.json
  5. Select required capabilities
  6. Click "Register"
  1. 访问Certificates, Identifiers & Profiles
  2. 点击「+」注册新标识符
  3. 选择「App IDs」然后选择「App」
  4. 输入描述信息,并填写与
    tauri.conf.json
    一致的显式Bundle ID
  5. 选择所需的功能权限
  6. 点击「Register」完成注册

Code Signing Setup

代码签名设置

Create Certificates

创建证书

Distribution Certificate (required for App Store):
  1. Open Keychain Access on macOS
  2. Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority
  3. Enter email, select "Saved to disk"
  4. Go to Certificates
  5. Click "+" and select "Apple Distribution"
  6. Upload the certificate signing request
  7. Download and double-click to install
分发证书(App Store必需):
  1. 在macOS上打开Keychain Access
  2. 依次选择Keychain Access > Certificate Assistant > Request a Certificate from a Certificate Authority
  3. 输入邮箱地址,选择「Saved to disk」
  4. 访问Certificates
  5. 点击「+」并选择「Apple Distribution」
  6. 上传证书签名请求文件
  7. 下载证书并双击安装

Create Provisioning Profile

创建配置描述文件

App Store Distribution Profile:
  1. Go to Profiles
  2. Click "+" to create new profile
  3. Select "App Store Connect" under Distribution
  4. Select your App ID
  5. Select your distribution certificate
  6. Name and generate the profile
  7. Download the
    .mobileprovision
    file
App Store分发配置描述文件:
  1. 访问Profiles
  2. 点击「+」创建新配置文件
  3. 在分发类型中选择「App Store Connect」
  4. 选择你的App ID
  5. 选择你的分发证书
  6. 命名并生成配置文件
  7. 下载
    .mobileprovision
    文件

Install Provisioning Profile

安装配置描述文件

bash
undefined
bash
undefined

Copy to Xcode provisioning profiles directory

复制到Xcode配置描述文件目录

cp ~/Downloads/YourApp_AppStore.mobileprovision
~/Library/MobileDevice/Provisioning\ Profiles/

Or double-click the file to install automatically.
cp ~/Downloads/YourApp_AppStore.mobileprovision
~/Library/MobileDevice/Provisioning\ Profiles/

或直接双击文件自动安装。

Xcode Project Configuration

Xcode项目配置

Open the Tauri iOS project in Xcode:
bash
tauri ios build --open
在Xcode中打开Tauri iOS项目:
bash
tauri ios build --open

Configure Signing in Xcode

在Xcode中配置签名

  1. Select the project in the navigator
  2. Select your app target
  3. Go to "Signing & Capabilities" tab
  4. Uncheck "Automatically manage signing" for manual control
  5. Select your Team
  6. Select the App Store provisioning profile
  1. 在导航栏中选择项目
  2. 选择你的应用目标
  3. 切换到「Signing & Capabilities」标签页
  4. 取消勾选「Automatically manage signing」以手动控制
  5. 选择你的开发团队
  6. 选择App Store分发配置描述文件

Required Capabilities

必需的功能权限

Add capabilities based on app requirements:
CapabilityWhen Required
Push NotificationsIf using APNs
Background ModesFor background tasks
App GroupsFor sharing data between extensions
Associated DomainsFor universal links
根据应用需求添加相应的功能权限:
功能权限适用场景
Push Notifications使用APNs推送通知时
Background Modes需要后台任务时
App Groups需在扩展与主应用间共享数据时
Associated Domains使用通用链接时

Info.plist Configuration

Info.plist配置

Located at
src-tauri/gen/apple/[AppName]_iOS/Info.plist
:
xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>Your App Name</string>
    <key>CFBundleName</key>
    <string>YourApp</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>NSCameraUsageDescription</key>
    <string>This app requires camera access for...</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app requires photo library access for...</string>
</dict>
</plist>
Required usage descriptions (add only if your app uses these features):
  • NSCameraUsageDescription
    : Camera access
  • NSPhotoLibraryUsageDescription
    : Photo library
  • NSLocationWhenInUseUsageDescription
    : Location services
  • NSMicrophoneUsageDescription
    : Microphone access
配置文件路径:
src-tauri/gen/apple/[AppName]_iOS/Info.plist
xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDisplayName</key>
    <string>Your App Name</string>
    <key>CFBundleName</key>
    <string>YourApp</string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleVersion</key>
    <string>$(CURRENT_PROJECT_VERSION)</string>
    <key>CFBundleShortVersionString</key>
    <string>$(MARKETING_VERSION)</string>
    <key>UILaunchStoryboardName</key>
    <string>LaunchScreen</string>
    <key>UISupportedInterfaceOrientations</key>
    <array>
        <string>UIInterfaceOrientationPortrait</string>
        <string>UIInterfaceOrientationLandscapeLeft</string>
        <string>UIInterfaceOrientationLandscapeRight</string>
    </array>
    <key>NSCameraUsageDescription</key>
    <string>This app requires camera access for...</string>
    <key>NSPhotoLibraryUsageDescription</key>
    <string>This app requires photo library access for...</string>
</dict>
</plist>
必需的权限描述(仅当应用使用对应功能时添加):
  • NSCameraUsageDescription
    : 相机访问权限说明
  • NSPhotoLibraryUsageDescription
    : 相册访问权限说明
  • NSLocationWhenInUseUsageDescription
    : 定位服务权限说明
  • NSMicrophoneUsageDescription
    : 麦克风访问权限说明

App Icons

应用图标

Generate iOS app icons from a source image (1024x1024 recommended):
bash
tauri icon /path/to/app-icon.png --ios-color '#ffffff'
This generates all required icon sizes in
src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/
.
从源图片(推荐尺寸1024x1024)生成iOS应用图标:
bash
tauri icon /path/to/app-icon.png --ios-color '#ffffff'
该命令会在
src-tauri/gen/apple/Assets.xcassets/AppIcon.appiconset/
目录下生成所有所需尺寸的图标。

Building for App Store

为App Store构建应用

Command Line Build

命令行构建

bash
undefined
bash
undefined

Build IPA for App Store Connect

构建用于App Store Connect的IPA文件

tauri ios build --export-method app-store-connect

The IPA is generated at:
src-tauri/gen/apple/build/arm64/[AppName].ipa
undefined
tauri ios build --export-method app-store-connect

IPA文件生成路径:
src-tauri/gen/apple/build/arm64/[AppName].ipa
undefined

Build Options

构建选项

bash
undefined
bash
undefined

Build with specific target

指定目标架构构建

tauri ios build --target aarch64-apple-ios --export-method app-store-connect
tauri ios build --target aarch64-apple-ios --export-method app-store-connect

Build in release mode (default for export-method)

以Release模式构建(export-method默认模式)

tauri ios build --release --export-method app-store-connect
tauri ios build --release --export-method app-store-connect

Build and open in Xcode for manual archive

构建并在Xcode中打开以手动归档

tauri ios build --open
undefined
tauri ios build --open
undefined

Archive via Xcode (Alternative)

通过Xcode归档(替代方案)

  1. Open project:
    tauri ios build --open
  2. Select "Any iOS Device" as destination
  3. Product > Archive
  4. Window > Organizer to view archives
  5. Click "Distribute App"
  6. Select "App Store Connect"
  7. Follow the wizard
  1. 打开项目:
    tauri ios build --open
  2. 选择「Any iOS Device」作为目标设备
  3. 选择Product > Archive
  4. 通过Window > Organizer查看归档文件
  5. 点击「Distribute App」
  6. 选择「App Store Connect」
  7. 按照向导完成操作

App Store Connect API Key Setup

App Store Connect API密钥设置

Create an API key for automated uploads:
  1. Go to App Store Connect > Users and Access
  2. Select "Integrations" tab
  3. Click "App Store Connect API" then "+"
  4. Name the key and select "Admin" or "Developer" role
  5. Click "Generate"
  6. Download the
    .p8
    file (only available once)
  7. Note the Key ID and Issuer ID
创建API密钥以实现自动化上传:
  1. 访问App Store Connect > Users and Access
  2. 选择「Integrations」标签页
  3. 点击「App Store Connect API」然后点击「+」
  4. 为密钥命名并选择「Admin」或「Developer」角色
  5. 点击「Generate」生成密钥
  6. 下载
    .p8
    文件(仅可下载一次)
  7. 记录Key ID和Issuer ID

Store the API Key

存储API密钥

bash
undefined
bash
undefined

Create directory

创建目录

mkdir -p ~/.appstoreconnect/private_keys
mkdir -p ~/.appstoreconnect/private_keys

Move the key file (rename to include Key ID)

移动密钥文件(重命名以包含Key ID)

mv ~/Downloads/AuthKey_XXXXXXXXXX.p8 ~/.appstoreconnect/private_keys/
mv ~/Downloads/AuthKey_XXXXXXXXXX.p8 ~/.appstoreconnect/private_keys/

Alternative location

可选存储位置

mkdir -p ~/private_keys mv ~/Downloads/AuthKey_XXXXXXXXXX.p8 ~/private_keys/
undefined
mkdir -p ~/private_keys mv ~/Downloads/AuthKey_XXXXXXXXXX.p8 ~/private_keys/
undefined

Environment Variables (Optional)

环境变量(可选)

bash
export APPLE_API_KEY_ID="XXXXXXXXXX"
export APPLE_API_ISSUER="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
bash
export APPLE_API_KEY_ID="XXXXXXXXXX"
export APPLE_API_ISSUER="xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Uploading to App Store Connect

上传至App Store Connect

Using altool

使用altool工具

bash
xcrun altool --upload-app \
  --type ios \
  --file "src-tauri/gen/apple/build/arm64/YourApp.ipa" \
  --apiKey "$APPLE_API_KEY_ID" \
  --apiIssuer "$APPLE_API_ISSUER"
bash
xcrun altool --upload-app \
  --type ios \
  --file "src-tauri/gen/apple/build/arm64/YourApp.ipa" \
  --apiKey "$APPLE_API_KEY_ID" \
  --apiIssuer "$APPLE_API_ISSUER"

Using Transporter App

使用Transporter应用

  1. Download Transporter from Mac App Store
  2. Sign in with Apple ID
  3. Drag and drop the IPA file
  4. Click "Deliver"
  1. 从Mac App Store下载Transporter
  2. 使用Apple ID登录
  3. 拖拽IPA文件到应用中
  4. 点击「Deliver」完成上传

Using Xcode Organizer

使用Xcode Organizer

  1. Window > Organizer
  2. Select your archive
  3. Click "Distribute App"
  4. Select "App Store Connect"
  5. Choose "Upload" or "Export"
  6. Follow prompts
  1. 打开Window > Organizer
  2. 选择你的归档文件
  3. 点击「Distribute App」
  4. 选择「App Store Connect」
  5. 选择「Upload」或「Export」
  6. 按照提示完成操作

TestFlight Beta Testing

TestFlight Beta测试

After upload processing (typically 15-30 minutes):
上传完成后通常需要15-30分钟处理:

Internal Testing

内部测试

  1. App Store Connect > Your App > TestFlight
  2. Add internal testers (up to 100, must be App Store Connect users)
  3. Testers receive email invitation
  1. 进入App Store Connect > 你的应用 > TestFlight
  2. 添加内部测试人员(最多100人,必须是App Store Connect用户)
  3. 测试人员会收到邮件邀请

External Testing

外部测试

  1. Create a test group
  2. Add build to the group
  3. Submit for Beta App Review (required for external testers)
  4. Add external testers (up to 10,000)
  5. Testers install via TestFlight app
  1. 创建测试分组
  2. 将构建版本添加到分组
  3. 提交Beta应用审核(外部测试人员必需)
  4. 添加外部测试人员(最多10,000人)
  5. 测试人员通过TestFlight应用安装

App Store Submission

App Store提交

Create App in App Store Connect

在App Store Connect中创建应用

  1. Go to App Store Connect
  2. My Apps > "+" > New App
  3. Select iOS platform
  4. Enter app name, primary language, bundle ID, SKU
  5. Click "Create"
  1. 访问App Store Connect
  2. 进入My Apps > 「+」 > New App
  3. 选择iOS平台
  4. 输入应用名称、主语言、Bundle ID、SKU
  5. 点击「Create」

Prepare App Store Listing

准备App Store应用信息

Required assets:
AssetSpecification
Screenshots6.7" (1290x2796), 6.5" (1284x2778), 5.5" (1242x2208)
App Icon1024x1024 PNG (no alpha)
DescriptionUp to 4000 characters
KeywordsUp to 100 characters
Support URLRequired
Privacy Policy URLRequired
必需的资源:
资源规格要求
截图6.7" (1290x2796), 6.5" (1284x2778), 5.5" (1242x2208)
应用图标1024x1024 PNG(无透明通道)
应用描述最多4000字符
关键词最多100字符
支持URL必填
隐私政策URL必填

App Privacy

应用隐私设置

Complete the App Privacy questionnaire:
  1. App Store Connect > Your App > App Privacy
  2. Answer questions about data collection
  3. Specify data types collected
  4. Indicate data usage purposes
完成应用隐私问卷:
  1. 进入App Store Connect > 你的应用 > App Privacy
  2. 回答数据收集相关问题
  3. 指定收集的数据类型
  4. 说明数据使用目的

Submit for Review

提交审核

  1. Select your build in App Store Connect
  2. Complete all required metadata
  3. Answer export compliance questions
  4. Click "Submit for Review"
Review typically takes 24-48 hours.
  1. 在App Store Connect中选择你的构建版本
  2. 完成所有必需的元数据填写
  3. 回答出口合规相关问题
  4. 点击「Submit for Review」
审核通常需要24-48小时。

Common Issues and Solutions

常见问题与解决方案

Code Signing Errors

代码签名错误

"No signing certificate found"
bash
undefined
"未找到签名证书"
bash
undefined

List available certificates

列出可用证书

security find-identity -v -p codesigning
security find-identity -v -p codesigning

Verify certificate is valid

验证证书有效性

security find-certificate -c "Apple Distribution" -p

**"Provisioning profile doesn't match"**
- Ensure bundle ID matches exactly in all locations
- Regenerate provisioning profile if certificates changed
security find-certificate -c "Apple Distribution" -p

**"配置描述文件不匹配"**
- 确保所有位置的Bundle ID完全一致
- 若证书变更,重新生成配置描述文件

Build Failures

构建失败

"Unsupported architecture"
bash
undefined
"不支持的架构"
bash
undefined

Ensure building for correct target

确保为正确的目标架构构建

tauri ios build --target aarch64-apple-ios --export-method app-store-connect

**"Missing entitlements"**
- Check capabilities in Xcode match App ID capabilities
- Regenerate provisioning profile after capability changes
tauri ios build --target aarch64-apple-ios --export-method app-store-connect

**"缺少权限配置"**
- 检查Xcode中的功能权限与App ID权限是否匹配
- 变更权限后重新生成配置描述文件

Upload Errors

上传错误

"Invalid binary"
  • Ensure minimum iOS version is set correctly
  • Verify all required icons are present
  • Check Info.plist has required keys
"Missing compliance" Add to Info.plist if not using encryption:
xml
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
"无效的二进制文件"
  • 确保最低iOS版本设置正确
  • 验证所有必需图标已存在
  • 检查Info.plist包含所有必需的键
"缺少合规声明" 若应用未使用加密,在Info.plist中添加:
xml
<key>ITSAppUsesNonExemptEncryption</key>
<false/>

CI/CD Integration

CI/CD集成

GitHub Actions Example

GitHub Actions示例

yaml
name: iOS Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build-ios:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install Rust
        uses: dtolnay/rust-action@stable
        with:
          targets: aarch64-apple-ios

      - name: Install dependencies
        run: npm ci

      - name: Install certificate
        env:
          CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
          CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
        run: |
          CERTIFICATE_PATH=$RUNNER_TEMP/certificate.p12
          KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

          echo -n "$CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_PATH

          security create-keychain -p "" $KEYCHAIN_PATH
          security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
          security unlock-keychain -p "" $KEYCHAIN_PATH

          security import $CERTIFICATE_PATH -P "$CERTIFICATE_PASSWORD" \
            -A -t cert -f pkcs12 -k $KEYCHAIN_PATH

          security list-keychain -d user -s $KEYCHAIN_PATH

      - name: Install provisioning profile
        env:
          PROVISIONING_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}
        run: |
          PP_PATH=$RUNNER_TEMP/profile.mobileprovision
          echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode > $PP_PATH
          mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
          cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/

      - name: Build iOS
        run: npm run tauri ios build -- --export-method app-store-connect

      - name: Upload to App Store Connect
        env:
          APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
          APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
          APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
        run: |
          mkdir -p ~/.appstoreconnect/private_keys
          echo "$APPLE_API_KEY" > ~/.appstoreconnect/private_keys/AuthKey_$APPLE_API_KEY_ID.p8

          xcrun altool --upload-app --type ios \
            --file src-tauri/gen/apple/build/arm64/*.ipa \
            --apiKey $APPLE_API_KEY_ID \
            --apiIssuer $APPLE_API_ISSUER
yaml
name: iOS Release

on:
  push:
    tags:
      - 'v*'

jobs:
  build-ios:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install Rust
        uses: dtolnay/rust-action@stable
        with:
          targets: aarch64-apple-ios

      - name: Install dependencies
        run: npm ci

      - name: Install certificate
        env:
          CERTIFICATE_BASE64: ${{ secrets.APPLE_CERTIFICATE_BASE64 }}
          CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
        run: |
          CERTIFICATE_PATH=$RUNNER_TEMP/certificate.p12
          KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db

          echo -n "$CERTIFICATE_BASE64" | base64 --decode > $CERTIFICATE_PATH

          security create-keychain -p "" $KEYCHAIN_PATH
          security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
          security unlock-keychain -p "" $KEYCHAIN_PATH

          security import $CERTIFICATE_PATH -P "$CERTIFICATE_PASSWORD" \
            -A -t cert -f pkcs12 -k $KEYCHAIN_PATH

          security list-keychain -d user -s $KEYCHAIN_PATH

      - name: Install provisioning profile
        env:
          PROVISIONING_PROFILE_BASE64: ${{ secrets.PROVISIONING_PROFILE_BASE64 }}
        run: |
          PP_PATH=$RUNNER_TEMP/profile.mobileprovision
          echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode > $PP_PATH
          mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
          cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles/

      - name: Build iOS
        run: npm run tauri ios build -- --export-method app-store-connect

      - name: Upload to App Store Connect
        env:
          APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
          APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
          APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
        run: |
          mkdir -p ~/.appstoreconnect/private_keys
          echo "$APPLE_API_KEY" > ~/.appstoreconnect/private_keys/AuthKey_$APPLE_API_KEY_ID.p8

          xcrun altool --upload-app --type ios \
            --file src-tauri/gen/apple/build/arm64/*.ipa \
            --apiKey $APPLE_API_KEY_ID \
            --apiIssuer $APPLE_API_ISSUER

Version Management

版本管理

Incrementing Versions

版本递增

For each App Store submission, increment appropriately:
json
{
  "version": "1.0.0",
  "bundle": {
    "iOS": {
      "bundleVersion": "1"
    }
  }
}
  • version
    : Increment for user-visible changes (1.0.0 -> 1.0.1 or 1.1.0)
  • bundleVersion
    : Must increment for every upload (1 -> 2 -> 3)
每次提交App Store时,需合理递增版本号:
json
{
  "version": "1.0.0",
  "bundle": {
    "iOS": {
      "bundleVersion": "1"
    }
  }
}
  • version
    : 针对用户可见的变更递增(1.0.0 -> 1.0.1 或 1.1.0)
  • bundleVersion
    : 每次上传必须递增(1 -> 2 -> 3)

Version Script Example

版本递增脚本示例

bash
#!/bin/bash
bash
#!/bin/bash

increment-build.sh

increment-build.sh

CONFIG="src-tauri/tauri.conf.json" CURRENT=$(jq -r '.bundle.iOS.bundleVersion' $CONFIG) NEW=$((CURRENT + 1)) jq ".bundle.iOS.bundleVersion = "$NEW"" $CONFIG > tmp.json && mv tmp.json $CONFIG echo "Bundle version incremented to $NEW"
undefined
CONFIG="src-tauri/tauri.conf.json" CURRENT=$(jq -r '.bundle.iOS.bundleVersion' $CONFIG) NEW=$((CURRENT + 1)) jq ".bundle.iOS.bundleVersion = "$NEW"" $CONFIG > tmp.json && mv tmp.json $CONFIG echo "Bundle version incremented to $NEW"
undefined

Reference Links

参考链接