我正在使用flutter并试图构建ipa文件,我能够运行我的应用程序,我的设备或模拟器没有问题,但无法构建ipa文件。我正在使用扑动命令flutter build ipa
,我得到这个错误:
Command PhaseScriptExecution failed with a nonzero exit code
我已经试着做了如下:
flutter clean
flutter pub get
cd ios
pod install
pod update
这是我的Podfile:
platform :ios, '11.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}
def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end
File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
flutter_ios_podfile_setup
target 'Runner' do
use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git'
end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
这是我的pubspec。yaml文件:
name: myApp
description: An app for parents built by parents
version: 1.0.0+1
environment:
sdk: ">=2.15.1 <3.0.0"
dependencies:
flutter:
sdk: flutter
firebase_core: 1.12.0
firebase_auth: 3.3.6
cloud_firestore: 3.1.7
firebase_messaging: 11.2.6
firebase_database: 9.0.6
firebase_storage: 10.2.6
shared_preferences: 2.0.12
json_annotation: 4.4.0
uuid: 3.0.5
flutter_easyloading: 3.0.3
flutter_svg: 1.0.3
adaptive_dialog: 1.3.0
image_picker: 0.8.4+5
charts_flutter: 0.12.0
url_launcher: 6.0.12
dart_date: 1.1.1
carousel_slider: 4.0.0
dots_indicator: 2.1.0
open_mail_app: 0.4.4
percent_indicator: 4.0.0
audioplayers: 0.20.1
number_picker_dialog: 0.0.1
share_plus: 3.1.0
flutter_tabler_icons: 1.1.1
flutter_local_notifications: 9.4.0
intl: 0.17.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: 1.0.0
build_runner: 2.1.7
json_serializable: 6.1.4
flutter_icons:
android: "launcher_icon"
ios: true
remove_alpha_ios: true
image_path: "assets/icons/logo.png"
flutter_launcher_name:
name: "MyApp"
flutter:
uses-material-design: true
assets:
- assets/images/intro/
- assets/images/questions/
- assets/images/badges/
- assets/icons/
- assets/data/
- assets/audio/
fonts:
- family: Chalkboard
fonts:
- asset: assets/fonts/chalkboard/Daneehand Demo.otf
- family: Poppins-Light
fonts:
- asset: assets/fonts/poppins/Poppins-Light.ttf
- family: Poppins-Regular
fonts:
- asset: assets/fonts/poppins/Poppins-Regular.ttf
- family: Poppins-Medium
fonts:
- asset: assets/fonts/poppins/Poppins-Medium.ttf
- family: Poppins-SemiBold
fonts:
- asset: assets/fonts/poppins/Poppins-SemiBold.ttf
- family: Poppins-Bold
fonts:
- asset: assets/fonts/poppins/Poppins-Bold.ttf
谁能告诉我我做错了什么?将您的SDK版本从flutter升级版本3.0.2更新到3.0.3。
export PATH="your_path/flutter/bin:$PATH"
flutter clean
flutter pub get
cd ios
sudo gem pod install
pod install
run the app from Android Studio IDE so that it checks all the necessary installs.
flutter build ipa --release -t lib/main.dart
希望对你有帮助。
您可以检查以下步骤:
- 进入iOs文件夹,删除podlock文件和pods文件夹 进入pod文件并编辑下面的部分,其中包含如下代码:
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'
end
end
end
- 打开终端,cd到iOS文件夹,然后运行"pod cache clean -all">命令
- 运行pod install(pod update)命令
尝试用XCode IDE重新归档
在多次尝试使用Xcode失败后,我尝试了flutter build ipa --release
与终端没有使用Xcode,它建立像一个魅力。
上传ipa文件到App Store Connect:
- 将
build/ios/ipa/*.ipa
包拖放到Apple Transporter macOS应用程序https://apps.apple.com/us/app/transporter/id1450874784
或
- 运行
xcrun altool --upload-app --type ios -f build/ios/ipa/*.ipa --apiKey your_api_key --apiIssuer your_issuer_id
。参见"man altool";有关如何使用App Store Connect API密钥进行认证的详细信息。
首先从首选项中清除派生数据,并将其从bin中删除
flutter clean
flutter pub get
cd ios
pod install
pod update
我也是同样的问题,
两天后我终于知道了。
在我的情况下
将3.0.2
版本升级到3.0.3
版本
当依赖项没有更新时,我通常会遇到这个问题。您可以尝试以下步骤,这通常对我有效:
1-删除你的Podfile。我喜欢使用命令"rm -rf Podfile"。在终端上锁定这个)
2-删除你的Pods文件夹(我喜欢在终端中使用命令'rm -rf Pods')
3-删除。xcworkspace
4- Pod安装
5- Clear your project into XCode>Product>Clean Build Folder
这主要是因为您的机器空间较少。清理一些空间,删除旧版本的派生数据和存档
导出数据的路径
~/Library/Developer/Xcode/DerivedData
在查找器中输入->去→进入
文件夹你也可以重新启动你的机器来清理所有的临时文件
也可以尝试直接从xcode构建