小工具知识网

当前位置: 首页 > 行业知识 > flutter 打包iOS安装包

行业知识

flutter 打包iOS安装包

2026-11-04 02:41:09 来源:互联网转载

flutter iOS Xcode打包并导出ipa文件安装包

1、 Xcode配置

1、 启动打包

1、 等待打包

1、 打包完成、准备导出ipa

1、 选择模式

1、 选择配置文件

1、 导出

1、 选择导出位置

1、 得到ipa

podfile文件如下

# Uncomment this line to define a global platform for your projectplatform :ios, '12.0'use_frameworks!# 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"endrequire File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)flutter_ios_podfile_setuptarget 'Runner' do  flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))  pod 'DKPhotoGallery','0.0.17', :modular_headers => true  pod 'SDWebImage','5.17.0', :modular_headers => true  pod 'FirebaseSessions','10.12.0', :modular_headers => true  pod 'FirebaseCore','10.6.0', :modular_headers => true  pod 'FirebaseCoreExtension','10.12.0', :modular_headers => true  pod 'FirebaseInstallations','10.12.0', :modular_headers => true  pod 'GoogleDataTransport','9.2.3', :modular_headers => true  pod 'GoogleUtilities','7.11.4', :modular_headers => true  pod 'nanopb','2.30909.0', :modular_headers => true  use_frameworks!endpost_install do |installer|//会因为下面这块run不起来,但是product- archive打不了包#   installer.generated_projects.each do |project|#     project.targets.each do |target|#       target.build_configurations.each do |config|#         config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0'#       end#     end#   end  installer.pods_project.targets.each do |target|    flutter_additional_ios_build_settings(target)    # Start of the permission_handler configuration    target.build_configurations.each do |config|      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [        '$(inherited)',        'PERMISSION_CAMERA=1',        'PERMISSION_MICROPHONE=1',      ]    end    # End of the permission_handler configuration  endend

原来是这样子的,删掉了一部分代码

post_install do |installer|  installer.pods_project.targets.each do |target|    flutter_additional_ios_build_settings(target)    # Start of the permission_handler configuration    target.build_configurations.each do |config|      config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [        '$(inherited)',        'PERMISSION_CAMERA=1',        'PERMISSION_MICROPHONE=1',      ]    end    # End of the permission_handler configuration  endend

上一篇:通过一篇文章让你了解数据结构和算法的重要性

下一篇:ASP下载站源码揭秘,一键搭建文件分享平台的高效解决方案