Flutter自动打包ios ipa并且上传

该脚本会自动打包ios ipa 并自动上传至苹果后台,中间自动flutter clean ,自动 pod install

里面需要填写自己应用的 apiKey和apiIssuer

如我的例子中apiKey 为 1234 apiIssuer 为5678,

首先flutter 工程目录 新建 shell目录,目录下新建ipa.sh文件,拷贝如下代码

bash 复制代码
#!/bin/bash
###
 # @author: wds
 # @description: 
 # @LastEditTime: 2024-09-04 17:42:02
### 

echo "iOS 打包AppStore渠道包"

# Stop on errors
cd ..
set -e 

# Save current directory
current_dir=$(pwd)

# Clean the Flutter project
echo "Cleaning Flutter project..."
flutter clean

# Get all the dependencies
echo "Getting dependencies..."
flutter pub get

# Navigate to the iOS directory
echo "Navigating to the iOS directory..."

if [ -d "ios" ]; then
  cd ios
  
  # Install CocoaPods dependencies
  echo "Installing CocoaPods dependencies..."
  pod install

  # Go back to the original directory
  cd "$current_dir"
  echo "CocoaPods setup completed successfully."
  
  # Build the iOS app
  echo "Building the iOS app..."
  flutter build ipa --release --target=lib/main.dart
  
  echo "iOS app build completed successfully."

  # 上传
  echo "Upload ipa..."
  xcrun altool --upload-app --type ios -f build/ios/ipa/*.ipa --apiKey 1234 --apiIssuer 5678
  
  echo "Upload ipa successfully."
  
else
  echo "Error: 'ios' directory does not exist."
  exit 1
fi

# Optional: Open the iOS project in Xcode (uncomment if needed)
# echo "Opening iOS project in Xcode..."
# open ios/Runner.xcworkspace

echo "All tasks completed successfully."

运行

bash 复制代码
cd shell
执行 ./ipa.sh
相关推荐
水云桐程序员9 分钟前
Flutter与React Native的对比分析
flutter·react native·react.js
吠品10 分钟前
Go赋能:HTTP大文件秒传与断点续接
ios·iphone·xcode
1001101_QIA23 分钟前
android studio连接手机真机调试
flutter
唐诺9 小时前
【无标题】
ios·属性包装器·wrappers
莞凰11 小时前
昇腾CANN的“传音入密“:hccl仓库探秘
flutter·ui·transformer
5008413 小时前
Conv + BN + ReLU 融合:省掉两次显存读写
flutter·架构·开源·wpf·音视频
5008413 小时前
把 FlashAttention 讲清楚
flutter·electron·wpf
song50116 小时前
多卡训练加速:HCCL 集合通信实战
分布式·python·flutter·ci/cd·分类
测试员周周17 小时前
【Appium 系列】第14节-断言与验证 — Validator 的设计
android·人工智能·python·功能测试·ios·单元测试·appium
2501_9160088921 小时前
Mac 上生成 AppStoreInfo.plist 文件,App Store 上架
android·macos·ios·小程序·uni-app·iphone·webview