24

if a build the app it is correct. archieve is also correct. but when i upload app to Test Flight i get this error o MacOS 15 , Xcode 16 .

<IDEDistributionContext: 0x7f9ef32a6d50; archive = "<IDEArchive: 0x6000171f4620>", distributionMethod="(null)", team="(null)">
 <IDEDistributionContext: 0x7f9ef30a67d0; archive = "<IDEArchive: 0x6000171f4620>", distributionMethod="(null)", team="(null)">
 <IDEDistributionContext: 0x7f9ef0aff8d0; archive = "<IDEArchive: 0x6000171f4620>", distributionMethod="(null)", team="(null)">
</IDEDistributionContext: 0x7f9ef0a1a0f0>
2024年09月25日 10:05:15 +0000 [MT] Upload for archive TrueCaller had issues:
(
 "<IDEDistributionIssue: severity(error), error(Error Domain=ContentDelivery Code=90482 \"Asset validation failed\" UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription=Asset validation failed, NSLocalizedRecoverySuggestion=Invalid Executable. The executable 'TrueCaller.app/Frameworks/hermes.framework/hermes' contains bitcode. (ID: 70394fde-4ed8-40ca-b6a8-2aabb46b397a)})>"

5 Answers 5

80

I was getting the same issue after upgraded to Xcode 16 and iOS 18.

You can solve this issue by following this.

  1. Open Podfile

  2. Search for word post_install

  3. If post_install not found then just directly paste the below code just before the last end keyword

     post_install do |installer|
     bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
     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
     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"
     ]
     framework_paths.each do |framework_relative_path|
     strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
     end
    
  4. In case you have already post_install has been used then copy and past the below script inside that.

     bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
     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
     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"
     ]
     framework_paths.each do |framework_relative_path|
     strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
     end
    
  5. Do pod install

  6. Do archive again and try upload

answered Sep 25, 2024 at 11:42
Sign up to request clarification or add additional context in comments.

9 Comments

Is there any risk stripping all this bitcode? Will my app work correctly?
based off of this answer: stackoverflow.com/a/73219854/8183900 it seems like the answer to my comment is no
for anyone that gets stuck, this may sound silly, but running pod install is essential for this to work
thanks, this worked for me, I added the code to the end of "post_install do |installer|"
just to be clear. We don't have to remove what it was inside pod_install section. The code suggested here should be pasted after our current code if exists.
|
25

create a file in the ios folder with name `

handle_bitcode.sh`

use this commnad

touch handle_bitcode.sh

and then run this command

sudo chmod +x handle_bitcode.sh

and paste this script

#!/bin/bash
# Function to check if a binary contains bitcode
check_bitcode() {
 local binary_path=1ドル
 if otool -l "$binary_path" | grep -q __LLVM; then
 echo "$binary_path contains bitcode."
 echo "$binary_path" >> bitcode_frameworks.txt
 else
 echo "$binary_path does not contain bitcode."
 fi
}
# Function to strip bitcode from a binary
strip_bitcode() {
 local binary_path=1ドル
 local output_path="${binary_path}_stripped"
 xcrun bitcode_strip "$binary_path" -r -o "$output_path"
 echo "Stripped bitcode from $binary_path and saved to $output_path"
}
# Function to replace original binary with the stripped version
replace_framework() {
 local original_path=1ドル
 local stripped_path="${original_path}_stripped"
 if [ -f "$stripped_path" ]; then
 echo "Replacing $original_path with $stripped_path..."
 rm "$original_path"
 mv "$stripped_path" "$original_path"
 echo "Replaced $original_path successfully."
 else
 echo "Stripped binary $stripped_path not found. Skipping."
 fi
}
# Function to disable Bitcode in the Xcode project
disable_bitcode_in_project() {
 # Automatically detect the Xcode project file
 local xcodeproj_file=$(find . -name "*.xcodeproj" | head -n 1)
 if [ -z "$xcodeproj_file" ]; then
 echo "Xcode project not found. Exiting."
 exit 1
 fi
 local xcodeproj_name=$(basename "$xcodeproj_file" .xcodeproj)
 echo "Disabling Bitcode in Xcode project $xcodeproj_name..."
 /usr/libexec/PlistBuddy -c "Set :buildSettings:ENABLE_BITCODE NO" "$xcodeproj_file/project.pbxproj"
 # Clean and rebuild the Xcode project
 echo "Cleaning the build folder..."
 xcodebuild clean -workspace "$xcodeproj_name.xcworkspace" -scheme "$xcodeproj_name" -configuration Debug
 echo "Building the project..."
 xcodebuild -workspace "$xcodeproj_name.xcworkspace" -scheme "$xcodeproj_name" -configuration Debug
 echo "Process completed successfully!"
}
# Step 1: Check frameworks for Bitcode
echo "Checking frameworks for Bitcode..."
# Remove old bitcode_frameworks.txt if it exists
rm -f bitcode_frameworks.txt
# Check frameworks in Pods and the ios directory
if [ -d "Pods" ]; then
 echo "Checking frameworks in Pods..."
 find Pods -name '*.framework' -type d | while read -r framework; do
 binary_name=$(basename "$framework" .framework)
 binary_path="$framework/$binary_name"
 if [ -f "$binary_path" ]; then
 check_bitcode "$binary_path"
 fi
 done
fi
echo "Checking frameworks in the ios directory..."
find . -name '*.framework' -type d | while read -r framework; do
 binary_name=$(basename "$framework" .framework)
 binary_path="$framework/$binary_name"
 if [ -f "$binary_path" ]; then
 check_bitcode "$binary_path"
 fi
done
echo "Bitcode check completed. Frameworks containing bitcode are listed in bitcode_frameworks.txt."
# Step 2: Strip Bitcode from all frameworks that contain it
if [ -f bitcode_frameworks.txt ]; then
 echo "Stripping bitcode from frameworks..."
 while read -r binary_path; do
 strip_bitcode "$binary_path"
 done < bitcode_frameworks.txt
else
 echo "No frameworks found containing bitcode. Exiting."
 exit 1
fi
# Step 3: Replace original frameworks with stripped versions
echo "Replacing original frameworks with stripped versions..."
while read -r binary_path; do
 replace_framework "$binary_path"
done < bitcode_frameworks.txt
# Step 4: Disable Bitcode in the Xcode project and rebuild
disable_bitcode_in_project

in the termianl run this in ios folder

./handle_bitcode.sh

5 Comments

didnt work for me
@iamJohnvesly was that command successfull. i have tested it for react native and it worked
@Engr.AftabUfaq Thanks for the solution. This works for me
this solution works for me, and its the best as its a general solution not related to a certain pod or path
This is working absolutely fine :)
4

if you are using RN version below 0.72 you might face error like this change your podfile to this below is the full code of podfile ignore comments

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, '13.0'
install! 'cocoapods', :deterministic_uuids => false
target 'myApp' do
 config = use_native_modules!
 # Flags change depending on the env values.
 flags = get_default_flags()
 use_react_native!(
 :path => config[:reactNativePath],
 # to enable hermes on iOS, change `false` to `true` and then install pods
 :hermes_enabled => flags[:hermes_enabled],
 :fabric_enabled => flags[:fabric_enabled],
 # An absolute path to your application root.
 :app_path => "#{Pod::Config.instance.installation_root}/.."
 )
 
 pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons'
 pod 'RNCPicker', :path => '../node_modules/@react-native-picker/picker'
 pod 'RNReanimated', :path => '../node_modules/react-native-reanimated'
 target 'myAppTests' do
 inherit! :complete
 # Pods for testing
 end
 # Enables Flipper.
 #
 # Note that if you have use_frameworks! enabled, Flipper will not work and
 # you should disable the next line.
 use_flipper!()
 post_install do |installer|
 react_native_post_install(installer)
 __apply_Xcode_12_5_M1_post_install_workaround(installer)
 bitcode_strip_path = `xcrun --find bitcode_strip`.chomp
 unless bitcode_strip_path.empty?
 def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
 framework_path = File.join(Dir.pwd, framework_relative_path)
 if File.exist?(framework_path)
 command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
 puts "Stripping bitcode: #{command}"
 system(command)
 else
 puts "Framework not found at path: #{framework_path}, skipping bitcode strip."
 end
 end
 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"
 ]
 framework_paths.each do |framework_relative_path|
 strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
 end
 else
 puts "bitcode_strip tool not found, skipping bitcode stripping."
 end
 end
end

now run

pod install
answered Oct 23, 2024 at 6:49

1 Comment

i get two Framework not found at path: ... errors and validations fails
2

I create a function inside the podfile to avoid to create a sh file.

def strip_bitcode_from_frameworks
 puts "Checking frameworks for Bitcode..."
 # Find all .framework folders inside Pods
 frameworks = Dir.glob("Pods/**/*.framework")
 frameworks.each do |framework|
 # Get the binary inside the framework
 binary = File.join(framework, File.basename(framework, ".framework"))
 if File.exist?(binary)
 # Use otool to check for Bitcode (__LLVM section)
 contains_bitcode = `otool -l "#{binary}" | grep __LLVM`
 if contains_bitcode && !contains_bitcode.empty?
 puts "#{binary} contains Bitcode. Stripping..."
 stripped = "#{binary}_stripped"
 # Strip Bitcode using xcrun
 system("xcrun bitcode_strip \"#{binary}\" -r -o \"#{stripped}\"")
 if File.exist?(stripped)
 # Replace the original binary with the stripped one
 FileUtils.mv(stripped, binary, force: true)
 puts "Successfully stripped Bitcode from #{binary}"
 else
 puts "Failed to strip Bitcode from #{binary}"
 end
 end
 end
 end
 puts "🧹 Bitcode stripping completed."
 end

after my post_install I run this function.

This is a full example:

post_install do |installer|
 
 def strip_bitcode_from_frameworks
 puts "Checking frameworks for Bitcode..."
 # Find all .framework folders inside Pods
 frameworks = Dir.glob("Pods/**/*.framework")
 frameworks.each do |framework|
 # Get the binary inside the framework
 binary = File.join(framework, File.basename(framework, ".framework"))
 if File.exist?(binary)
 # Use otool to check for Bitcode (__LLVM section)
 contains_bitcode = `otool -l "#{binary}" | grep __LLVM`
 if contains_bitcode && !contains_bitcode.empty?
 puts "#{binary} contains Bitcode. Stripping..."
 stripped = "#{binary}_stripped"
 # Strip Bitcode using xcrun
 system("xcrun bitcode_strip \"#{binary}\" -r -o \"#{stripped}\"")
 if File.exist?(stripped)
 # Replace the original binary with the stripped one
 FileUtils.mv(stripped, binary, force: true)
 puts "Successfully stripped Bitcode from #{binary}"
 else
 puts "Failed to strip Bitcode from #{binary}"
 end
 end
 end
 end
 puts "🧹 Bitcode stripping completed."
 end
 installer.pods_project.targets.each do |target|
 target.build_configurations.each do |config|
 # my things
 end
 end
 installer.pods_project.build_configurations.each do |config|
 # my things
 end
 
 strip_bitcode_from_frameworks
end
answered Apr 11, 2025 at 16:42

1 Comment

Works fine with ReactNative 0.71.0 ! Thank you so much !
1

I encountered issues with hermes.framework/hermes containing bitcode and BoringSSL-GRPC after upgrading to Xcode 16. I’m not sure why, but it seems to be getting worse day by day. These two errors started appearing right after the upgrade.

Fortunately, the following solution worked for me—you can fix the issue by using the code below:

Add Below code in your podfile after post_install do |installer|

 post_install do |installer|
 bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
 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
 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"
 ]
 framework_paths.each do |framework_relative_path|
 strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
 end
#second fix for BoringSSL-GRPC issue 
 
installer.pods_project.targets.each do |target|
 if target.name == 'BoringSSL-GRPC' # fix start from here (xcode 16 BoringSSL-GRPC issue)
 target.source_build_phase.files.each do |file|
 if file.settings && file.settings['COMPILER_FLAGS']
 flags = file.settings['COMPILER_FLAGS'].split
 flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
 file.settings['COMPILER_FLAGS'] = flags.join(' ')
 end
 end
 end # fix ends here (xcode 16 issue)
 
 end
 end

Then go to your project/ios folder and run pod install command

clear DerivedData open terminal and run these 2 commands

first cd ~/Library/Developer/xcode then run rm -rf DerivedData

answered Feb 28, 2025 at 7:31

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.