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
相关推荐
Digitally32 分钟前
5种将照片从iPhone传输到戴尔PC/笔记本电脑的方法
ios·电脑·iphone
月屯36 分钟前
平台消息推送(go)
数据库·后端·golang·cocoa·iphone·gin
ajassi200038 分钟前
开源 Objective-C IOS 应用开发(三)第一个iPhone的APP
ios·开源·objective-c
恋猫de小郭1 小时前
Flutter 3.38 发布,快来看看有什么更新吧
android·前端·flutter
Daniel_Coder7 小时前
iOS Widget 开发-9:可配置 Widget:使用 IntentConfiguration 实现参数选择
ios·swiftui·swift·widget·intents
非专业程序员Ping9 小时前
Vibe Coding 实战!花了两天时间,让 AI 写了一个富文本渲染引擎!
ios·ai·swift·claude·vibecoding
00后程序员张11 小时前
HTTP抓包工具推荐,Fiddler配置方法、代理设置与使用教程详解(开发者必学网络调试技巧)
网络·http·ios·小程序·fiddler·uni-app·webview
2501_9400940212 小时前
iphone Delta模拟器如何从夸克网盘导入游戏ROM 附游戏资源下载
游戏·ios·iphone
lichong95115 小时前
Android studio release 包打包配置 build.gradle
android·前端·ide·flutter·android studio·大前端·大前端++
旧时光_16 小时前
第3章:基础组件 —— 3.6 进度指示器
flutter