Xcode Archive failed with flutter plugins
Solution 1
Downgrading Xcode from 13.3 to 13.2.1 solved my problems.
Solution 2
I added below line in to Podfile in ios folder. I managed to Archive the app and upload to App Store. My Xcode version is 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
Solution 3
This is a Xcode 13.3 or Swift 5.6 bug happened when you use UI_USER_INTERFACE_IDIOM()
.
Replacing it with UIDevice.current.userInterfaceIdiom
resolves this error.
Check more discussions in [SR-1600] and this thread.
blue492
Updated on January 04, 2023Comments
-
blue492 over 1 year
My flutter app run well, but when I try to upload the app to App Store by archive it: Xcode -> Product -> Archive
it failed and get two errors First one in flutter_inappwebview with following error message: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
Second issue in 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')
I did pod install & update, did many things but it did not helped How to fix this problem, thanks
Podfile
# 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
-
tomerpacific about 2 yearsCan you share your pubspec.yaml file and your podfile?
-
blue492 about 2 years@tomerpacific I updated now with pubspec.yaml file and podfile
-
Arbiter Chil about 2 years@blue492 Did you update xcode to 13.3?
-
blue492 about 2 years@ArbiterChil yes
-
Arbiter Chil about 2 years@blue492 Then you in luck if it does then that is the segmentation on the packages that needed to be update some packages also abort trap 6 which is needed to update some code so better for now is to go back for 13.2.1 xcode and wait for the author to update the swift file on the package so you have no control on that in some point but to us is wait
-
blue492 about 2 years@ArbiterChil how to downgrade xcode to 13.2.1?
-
Arbiter Chil about 2 years@blue492 download the 13.2.1 from here xcodereleases.com and also after expanding click the extracted file. first is goto Xcode->Preferences->location->Command Line Tools select 13.2.1 or just click the eextracted .xip file you downloaded
-
Arbiter Chil about 2 years@blue492 i edited my new comment
-
blue492 about 2 years@ArbiterChil downgrading to 13.2.1 solved my problems, I've spent hours to fix it, I wonder how to know if Xcode which makes these issues and not other things? Thanks for help
-
Arbiter Chil about 2 years@blue492 no problem glad to help i also encountered that late night last week after updating xcode but damn that thing show up hahaha so thats i have 3 versions og xcode i have in my mac hahaha
-
-
Richard Suarez about 2 yearsHad a similar issue but got the error due to (printing) pub and can also confirm that the downgrade is the proper solution
-
Karsten Silz about 2 yearsGot an "error: Segmentation fault: 11 (in target 'DKImagePickerController' from project 'Pods')" when building my Flutter app. Downgrading Xcode from 13.3 to 13.2.1 fixed it for me, too.
-
Christian X about 2 yearswow thanks, this was the only reliable and easy solution for me. Totally forgot about the fact, that this solution was a possibility. Thanks!
-
Christian X about 2 yearsjust one edit for anyone also following this solution: You also need to then run in the terminal: flutter clean --> pod deintegrate --> flutter pub get --> pod install . Then everything should run perfectly :)
-
Yogesh Tandel about 2 yearsYes. you have to run flutter clean and flutter pubget. The issue is not while running the app on the device but while Archiving.
-
Karsten Silz about 2 yearsEven with Xcode 13.3.1 and Flutter 10.2.4, I still got errors. The above line fixed it.