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
相关推荐
Geek_Vison3 小时前
保险APP已经用了Flutter,还能接入小程序吗?
flutter·小程序·uni-app·mpaas·小程序容器
FungLeo3 小时前
成为全栈·Flutter App 篇·go_router 与四 Tab App Shell:保留导航状态、深链和登录回跳
flutter·移动开发·成为全栈·go_router·路由设计·深链接
m0_738185823 小时前
Flutter 鸿蒙化实战:screen_protector 适配 OpenHarmony,防截屏/防泄露
flutter·华为·harmonyos·鸿蒙
老李IT笔记4 小时前
设备指纹由哪几个字段拼出来:换一块主板会变成新设备
ios·智能手机
andyweike4 小时前
iOS App 测试
ios·测试·ad hoc·分发
梦想的颜色9 小时前
【编程实战】AI 时代 APP 开发全栈硬核指南:技术选型 + AI 架构 + 模型落地全维度决策
python·flutter·react native·react.js·ai·桌面应用·milvus
茶底世界之下14 小时前
花瓣要更柔和,还是更有反差?用 Awaking 做一次对比度取舍
ios
yuanlaile1 天前
2026年全新Flutter 跨平台开发全栈学习资料整理
flutter·getx·鸿蒙 next·flutter开发鸿蒙·flutter入门实战·flutter全栈
Anhty1 天前
2026最新免费手机音频处理工具 !!
android·功能测试·ios·智能手机·音视频
2501_915909061 天前
iOS应用从开发到上架App Store的完整发布流程与步骤指南
android·ios·小程序·https·uni-app·webview