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
:
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:
- Open your project's
Podfile
- Place this script before the final
end
- Replace paths in
framework_paths
with your framework locations - Run
pod install
- 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
Method 2: Terminal Search
Use find
to locate frameworks causing issues. Replace glog
with your framework name:
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:
"Pods/FRAMEWORK_NAME/PATH_IN_PODS/FRAMEWORK_NAME.framework/FRAMEWORK_NAME"
Alternative Solutions
Manual Command-Line Stripping
Run this for each problematic framework:
xcrun bitcode_strip -r PATH_TO_FRAMEWORK_EXECUTABLE -o PATH_TO_FRAMEWORK_EXECUTABLE
Example:
xcrun bitcode_strip -r Pods/MapboxMobileEvents/.../MapboxMobileEvents -o Pods/MapboxMobileEvents/.../MapboxMobileEvents
Targeted Stripping (Single Framework)
Add conditions to remove bitcode from specific frameworks:
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:
- Identified all frameworks causing errors
- Added correct paths to the
framework_paths
array - Ran
pod install
successfully - Verified build validation passes in Xcode