Skip to content

Bitcode Validation Errors in Xcode 16

Problem: After upgrading to macOS Sequoia and Xcode 16, builds fail during App Store submission with the error: Asset validation failed invalid executable. The executable '...' contains bitcode. This occurs because Apple deprecated bitcode in Xcode 16, rejecting builds containing legacy bitcode-enabled frameworks.


Primary Solution: Modify Your Podfile

Add a post_install hook to your Podfile to automatically strip bitcode from identified frameworks during pod install:

ruby
post_install do |installer|
  bitcode_strip_path = `xcrun --find bitcode_strip`.chop!  # Locate bitcode_strip tool

  # Function to remove bitcode from frameworks
  def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
    framework_path = File.join(Dir.pwd, framework_relative_path)
    command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
    puts "Stripping bitcode: #{command}"
    system(command)
  end

  # List frameworks requiring bitcode stripping
  framework_paths = [
    "Pods/LogRocket/LogRocket.xcframework/ios-arm64/LogRocket.framework/LogRocket",
    "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/hermes",
    "Pods/hermes-engine/destroot/Library/Frameworks/macosx/hermes.framework/Versions/Current/hermes",
    "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64/hermes.framework/hermes",
    "Pods/hermes-engine/destroot/Library/Frameworks/universal/hermes.xcframework/ios-arm64_x86_64-maccatalyst/hermes.framework/hermes",
    # Add your error-triggering frameworks here
  ]

  # Execute stripping for every framework
  framework_paths.each do |path|
    strip_bitcode_from_framework(bitcode_strip_path, path)
  end
end

Steps:

  1. Open your project's Podfile
  2. Place this script before the final end
  3. Replace paths in framework_paths with your framework locations
  4. Run pod install
  5. Rebuild and submit your application

TIP

If you already have a post_install block, paste the code inside it instead of creating a new one.


Identifying Correct Framework Paths

Method 1: Use Xcode's Error Message

Copy the framework path directly from Xcode's build error log. For example:
Pods/YourFramework/Path/To/Framework.framework/Executable

Use find to locate frameworks causing issues. Replace glog with your framework name:

bash
cd ios && find Pods -name "glog"

Example paths returned:

Pods/Flipper-Glog/Frameworks/glog.xcframework/ios-arm64_i386_x86_64-simulator/glog.framework/glog
Pods/Flipper-Glog/Frameworks/glog.xcframework/ios-arm64_x86_64-maccatalyst/glog.framework/glog

Method 3: Generic Path Construction

Build paths using a consistent pattern:

ruby
"Pods/FRAMEWORK_NAME/PATH_IN_PODS/FRAMEWORK_NAME.framework/FRAMEWORK_NAME"

Alternative Solutions

Manual Command-Line Stripping

Run this for each problematic framework:

bash
xcrun bitcode_strip -r PATH_TO_FRAMEWORK_EXECUTABLE -o PATH_TO_FRAMEWORK_EXECUTABLE

Example:

bash
xcrun bitcode_strip -r Pods/MapboxMobileEvents/.../MapboxMobileEvents -o Pods/MapboxMobileEvents/.../MapboxMobileEvents

Targeted Stripping (Single Framework)

Add conditions to remove bitcode from specific frameworks:

ruby
post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == 'MapboxMobileEvents'
      system('xcrun -sdk iphoneos bitcode_strip -r Pods/.../MapboxMobileEvents -o Pods/.../MapboxMobileEvents')
    end
  end
end

Why This Works

  • Bitcode Deprecation: Xcode 16 no longer accepts binaries containing bitcode.
  • bitcode_strip Tool: Removes bitcode segments without impacting executable functionality.
  • The post_install approach automates bitcode removal during dependency installation.

WARNING

Always verify paths for frameworks listed in Xcode's error log. Incorrect paths will cause stripping to fail silently.

Final Checklist:

  1. Identified all frameworks causing errors
  2. Added correct paths to the framework_paths array
  3. Ran pod install successfully
  4. Verified build validation passes in Xcode