【问题标题】:Xcode Archive failed with flutter pluginsXcode Archive 因颤振插件而失败
【发布时间】:2022-07-29 17:07:45
【问题描述】:

我的 Flutter 应用运行良好,但是当我尝试通过存档将应用上传到 App Store 时: Xcode -> 产品 -> 存档
它失败并出现两个错误 flutter_inappwebview 中的第一个带有以下错误消息:

CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'flutter_inappwebview' from project 'Pods')
    cd /Users/user1/StudioProjects/app/ios/Pods
    export DEVELOPER_DIR\=/Applications/Xcode.app/Contents/Developer
    export SDKROOT\=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name flutter_inappwebview -O -whole-module-optimization -enforce-exclusivity\=checked @/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/Objects-normal/arm64/flutter_inappwebview.SwiftFileList -D COCOAPODS -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.4.sdk -target arm64-apple-ios12.0 -g -module-cache-path /Users/user1/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -embed-bitcode -swift-version 5 -I /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/flutter_inappwebview -F /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/flutter_inappwebview -F /Users/user1/flutter/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_armv7 -F /Users/osamahhaitham/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/OrderedSet -c -num-threads 4 -output-file-map /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/Objects-normal/arm64/flutter_inappwebview-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/Objects-normal/arm64/flutter_inappwebview.swiftmodule -Xcc -I/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/flutter_inappwebview-generated-files.hmap -Xcc -I/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/flutter_inappwebview-own-target-headers.hmap -Xcc -I/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/flutter_inappwebview-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/flutter_inappwebview-project-headers.hmap -Xcc -I/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/BuildProductsPath/Release-iphoneos/flutter_inappwebview/include -Xcc -I/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/DerivedSources-normal/arm64 -Xcc -I/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/DerivedSources/arm64 -Xcc -I/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/DerivedSources -Xcc -DPOD_CONFIGURATION_RELEASE\=1 -Xcc -DCOCOAPODS\=1 -emit-objc-header -emit-objc-header-path /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/Objects-normal/arm64/flutter_inappwebview-Swift.h -import-underlying-module -Xcc -ivfsoverlay -Xcc /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/flutter_inappwebview.build/unextended-module-overlay.yaml -working-directory /Users/user1/StudioProjects/app/ios/Pods

remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
Command CompileSwiftSources failed with a nonzero exit code

DKImagePickerController 中的第二个问题

SwiftCodeGeneration normal arm64 (in target 'DKImagePickerController' from project 'Pods')
    cd /Users/user1/StudioProjects/app/ios/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DKImagePickerController.build/Objects-normal/arm64/DKPopoverViewController.bc -embed-bitcode -target arm64-apple-ios9.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name DKImagePickerController -o /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DKImagePickerController.build/Objects-normal/arm64/DKPopoverViewController.o

LLVM ERROR: out of memory
Allocation failed
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DKImagePickerController.build/Objects-normal/arm64/DKPopoverViewController.bc -embed-bitcode -target arm64-apple-ios9.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name DKImagePickerController -o /Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DKImagePickerController.build/Objects-normal/arm64/DKPopoverViewController.o
1.  Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
2.  Compiling with the current language version
3.  Running pass 'Function Pass Manager' on module '/Users/user1/Library/Developer/Xcode/DerivedData/Runner-dmjvwbvrfekhkvanzgfshfxgayly/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DKImagePickerController.build/Objects-normal/arm64/DKPopoverViewController.bc'.
4.  Running pass 'ObjC ARC contraction' on function '@UI_USER_INTERFACE_IDIOM'
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x000000010fa19de7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 39
1  swift-frontend           0x000000010fa18e38 llvm::sys::RunSignalHandlers() + 248
2  swift-frontend           0x000000010fa1a440 SignalHandler(int) + 288
3  libsystem_platform.dylib 0x00007ff81c319dfd _sigtramp + 29
4  libsystem_malloc.dylib   0x00007ff81c137abb _malloc_zone_malloc + 125
5  libsystem_c.dylib        0x00007ff81c24fd24 abort + 123
6  swift-frontend           0x000000010f966cda llvm::report_bad_alloc_error(char const*, bool) + 106
7  swift-frontend           0x000000010f966cf2 out_of_memory_new_handler() + 18
8  libc++abi.dylib          0x00007ff81c2c196b operator new(unsigned long) + 43
9  swift-frontend           0x000000010f727efd llvm::Function::BuildLazyArguments() const + 77
10 swift-frontend           0x000000010d510e87 llvm::objcarc::BundledRetainClaimRVs::insertRVCallWithColors(llvm::Instruction*, llvm::CallBase*, llvm::DenseMap<llvm::BasicBlock*, llvm::TinyPtrVector<llvm::BasicBlock*>, llvm::DenseMapInfo<llvm::BasicBlock*>, llvm::detail::DenseMapPair<llvm::BasicBlock*, llvm::TinyPtrVector<llvm::BasicBlock*> > > const&) + 151
11 swift-frontend           0x000000010d523f88 (anonymous namespace)::ObjCARCContract::run(llvm::Function&, llvm::AAResults*, llvm::DominatorTree*) + 1384
12 swift-frontend           0x000000010f75f380 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1488
13 swift-frontend           0x000000010f766073 llvm::FPPassManager::runOnModule(llvm::Module&) + 67
14 swift-frontend           0x000000010f75fb39 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1161
15 swift-frontend           0x000000010ac7d6df swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 3791
16 swift-frontend           0x000000010ac7e8cc swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2812
17 swift-frontend           0x000000010ac87aa5 swift::performLLVM(swift::IRGenOptions const&, swift::ASTContext&, llvm::Module*, llvm::StringRef) + 213
18 swift-frontend           0x000000010a742795 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 16565
19 swift-frontend           0x000000010a7015d4 swift::mainEntry(int, char const**) + 1108
20 dyld                     0x000000011812c51e start + 462
error: Abort trap: 6 (in target 'DKImagePickerController' from project 'Pods')

我做了 pod install & update,做了很多事情,但没有帮助 如何解决这个问题,谢谢

播客文件

# Uncomment this line to define a global platform for your project
platform :ios, '12.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__))
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    flutter_additional_ios_build_settings(target)
  end
end

pubspec.yaml

name: app_test
description: app_test Flutter application.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 3.5.0+61 

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_localizations:  
    sdk: flutter
  shared_preferences: ^2.0.13  
  http: ^0.13.4  
  intl: ^0.17.0 
  encrypt: ^5.0.1 
  json_annotation: ^4.4.0 
  searchable_dropdown: ^1.1.3  
  flutter_typeahead: ^3.2.4  
  flutter_datetime_picker: ^1.5.1  
  image_picker: ^0.8.4+10 
  connectivity_plus: ^2.2.1  
  flutter_svg: ^0.23.0+1  
  file_picker: ^4.5.0 
  open_file: ^3.2.1  
  permission_handler: ^9.2.0  
  path_provider: ^2.0.9 
  sqflite: ^2.0.2 
  device_info_plus: ^3.2.2
  url_launcher: ^6.0.20 
  maps_launcher: ^2.0.1 
  package_info_plus: ^1.4.0 #package info
  flutter_html: ^2.2.1  #html display
  html_editor_enhanced: ^2.4.0+1 #html textbox summernote
  cupertino_icons: ^1.0.4 # Use with the CupertinoIcons class for iOS style icons.
  flutter_colorpicker: ^1.0.3
  syncfusion_flutter_calendar: ^19.4.55 
  geolocator: ^8.2.0
  mobile_scanner: ^1.0.0 


dev_dependencies:
  flutter_test:
    sdk: flutter
  platform: ^3.1.0

【问题讨论】:

  • 你能分享你的 pubspec.yaml 文件和你的 podfile 吗?
  • @tomerpacific 我现在用 pubspec.yaml 文件和 podfile 进行了更新
  • @blue492 你更新 xcode 到 13.3 了吗?
  • @blue492 从这里下载 13.2.1 xcodereleases.com 并在展开后单击提取的文件。首先是转到 Xcode->Preferences->location->Command Line Tools 选择 13.2.1 或者只需单击您下载的 eextracted .xip 文件
  • @blue492 没问题很高兴帮助我上周深夜更新 xcode 后我也遇到了,但该死的东西出现了哈哈哈,所以我的 mac 中有 3 个版本的 xcode 哈哈哈

标签: xcode flutter


【解决方案1】:

我在 ios 文件夹中的 Podfile 中添加了以下行。我设法存档应用程序并上传到 App Store。我的 Xcode 版本是 13.3

pod 'DKImagePickerController/PhotoGallery', :git => 'https://github.com/miguelpruivo/DKImagePickerController.git'

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

【讨论】:

  • 哇,谢谢,这对我来说是唯一可靠且简单的解决方案。完全忘记了这个解决方案是可能的事实。谢谢!
  • 对于同样遵循此解决方案的任何人只需进行一次编辑:您还需要在终端中运行:flutter clean --> pod deintegrate --> flutter pub get --> pod install 。那么一切都应该完美运行:)
  • 是的。你必须运行flutter clean和flutter pubget。问题不是在设备上运行应用程序时,而是在存档时。
  • 即使使用 Xcode 13.3.1 和 Flutter 10.2.4,我仍然遇到错误。上面的行修复了它。
【解决方案2】:

将 Xcode 从 13.3 降级到 13.2.1 解决了我的问题。

【讨论】:

  • 遇到了类似的问题,但由于(打印)pub 而出现错误,也可以确认降级是正确的解决方案
  • 在构建我的 Flutter 应用程序时出现“错误:分段错误:11(在项目 'Pods' 的目标 'DKImagePickerController' 中)”。将 Xcode 从 13.3 降级到 13.2.1 也为我解决了这个问题。
【解决方案3】:

这是您使用 UI_USER_INTERFACE_IDIOM() 时发生的 Xcode 13.3 或 Swift 5.6 错误。

将其替换为 UIDevice.current.userInterfaceIdiom 可解决此错误。

查看[SR-16003]this thread 中的更多讨论。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-08-07
    • 2018-03-05
    • 1970-01-01
    • 1970-01-01
    • 2021-06-06
    • 2018-08-09
    • 1970-01-01
    相关资源
    最近更新 更多