Xcode 13.3 – DKImagePickerController – Error (Xcode): Segmentation fault: 11 Encountered error while archiving for device.

After upgrading to Xcode 13.3 and iOS 15.4,

  • no issues encountered while debugging app on iPhone.
  • no issues building Android appbundle
  • however, encountered the below when building iOS app flutter build ipa --obfuscate --split-debug-info=debug-info will encounter the below error.
  • have tried pod deintegrate && rm Podfile.lock && pod install > flutter clean > rm -rf ~/Library/Developer/Xcode/DerivedData then rebuild, same issue encountered.

Appreciate if you someone can shed some light as I have an app (with fatal bugs fixed) to release today. Thanks!

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

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/myname/Library/Developer/Xcode/DerivedData/Runner-faokyziihkhtwugbkjwfnzeicqgb/Build/Intermediates.noindex/ArchiveIntermediates/Runner/IntermediateBuildFilesPath/Pods.build/Release-iphoneos/DKImagePickerController.build/Objects-normal/arm64/DKPopoverViewController.bc -embed-bitcode -target arm64-apple-ios12.0 -Xllvm -aarch64-use-tbi -O -disable-llvm-optzns -module-name DKImagePickerController -o /Users/myname/Library/Developer/Xcode/DerivedData/Runner-faokyziihkhtwugbkjwfnzeicqgb/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/myname/Library/Developer/Xcode/DerivedData/Runner-faokyziihkhtwugbkjwfnzeicqgb/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           0x000000010503ef88 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x000000010503df9c llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x000000010503f618 SignalHandler(int) + 344
3  libsystem_platform.dylib 0x000000019e6914c4 _sigtramp + 56
4  swift-frontend           0x0000000102fbce8c 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&) + 64
5  swift-frontend           0x0000000102fcd878 (anonymous namespace)::ObjCARCContract::run(llvm::Function&, llvm::AAResults*, llvm::DominatorTree*) + 1024
6  swift-frontend           0x0000000104db2e24 llvm::FPPassManager::runOnFunction(llvm::Function&) + 1292
7  swift-frontend           0x0000000104db938c llvm::FPPassManager::runOnModule(llvm::Module&) + 60
8  swift-frontend           0x0000000104db35a8 llvm::legacy::PassManagerImpl::run(llvm::Module&) + 1088
9  swift-frontend           0x0000000100d7eee8 swift::performLLVMOptimizations(swift::IRGenOptions const&, llvm::Module*, llvm::TargetMachine*) + 3376
10 swift-frontend           0x0000000100d7fe28 swift::performLLVM(swift::IRGenOptions const&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef, swift::UnifiedStatsReporter*) + 2440
11 swift-frontend           0x0000000100d88364 swift::performLLVM(swift::IRGenOptions const&, swift::ASTContext&, llvm::Module*, llvm::StringRef) + 180
12 swift-frontend           0x00000001008e0ea0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6976
13 swift-frontend           0x00000001008a8130 swift::mainEntry(int, char const**) + 808
14 dyld                     0x00000001078a1088 start + 516
error: Segmentation fault: 11 (in target 'DKImagePickerController' from project 'Pods')

[✓] Flutter (Channel stable, 2.10.3, on macOS 12.3 21E230 darwin-arm, locale
    en-SG)
    • Flutter version 2.10.3 at /Users/myname/Projects/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 7e9793dee1 (13 days ago), 2022-03-02 11:23:12 -0600
    • Engine revision bd539267b4
    • Dart version 2.16.1
    • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/myname/Library/Android/sdk
    • Platform android-31, build-tools 30.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • CocoaPods version 1.11.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)

[✓] VS Code (version 1.65.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.36.0

[✓] Connected device (2 available)
    • myiPhone (mobile) • 00008110-001938481E04801E • ios            • iOS 15.4 19E241
    • Chrome (web)     • chrome                    • web-javascript • Google Chrome 99.0.4844.51

[✓] HTTP Host Availability
    • All required HTTP hosts are available

2 thoughts on “Xcode 13.3 – DKImagePickerController – Error (Xcode): Segmentation fault: 11 Encountered error while archiving for device.

  1. It looks like using this expression: UI_USER_INTERFACE_IDIOM() causes Xcode 13.3 with Swift 5.6 to fail. The fix should be to replace with: UIDevice.current.userInterfaceIdiom. UI_USER_INTERFACE_IDIOM() can be found in a few places in DKImagePickerController.

Comments are closed.