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
相关推荐
秋雨梧桐叶落莳4 小时前
iOS——3GShare项目总结
学习·macos·ios·objective-c·cocoa
浮江雾5 小时前
Flutter第九节-----Align与Padding实战指南
linux·服务器·开发语言·flutter·入门
西西学代码16 小时前
Charge-BleDevice
flutter
AIsoft_868820 小时前
iOS端录音转文字工具实测:自媒体创作者高效整理指南
ios·媒体
子非鱼94271 天前
07-Flutter 鸿蒙实战 07:故事集列表与缓存设计
学习·flutter·缓存·华为·harmonyos
子非鱼94271 天前
08-Flutter 鸿蒙实战 08:故事详情页,编辑、删除、重新生成与底部弹层
flutter·华为·harmonyos
子非鱼94271 天前
06-Flutter 鸿蒙实战 06:上传后处理流程,照片识别、故事生成和状态刷新
学习·flutter·华为·harmonyos
库奇噜啦呼1 天前
【iOS】Core Data
ios
sTone873751 天前
写时复制COW的第一性理解
android·c++·flutter
nicepainkiller1 天前
codex 逆向 flutter
flutter·flutter 逆向