Skip to content
Engineering

Fixing Xcode 16 Issue: Uploading Issue Related to Bitcode

2 min readBy Aerotix

Cover image for the article "Fixing Xcode 16 Issue: Uploading Issue Related to Bitcode"

When building and uploading apps to the App Store using Xcode 16, you may encounter an issue related to Bitcode that prevents your app from successfully uploading. This typically occurs when your project includes third-party frameworks or libraries with Bitcode enabled, and Xcode fails to handle them during the build process. Here’s a simple workaround to resolve the issue by stripping Bitcode from specific frameworks before uploading.

In this article, I’ll guide you through a solution that I implemented to address this bitcode stripping issue, ensuring smooth uploads and compliance with Xcode 16 requirements.

The Issue:

The primary challenge stems from changes in Xcode 16 that affect how bitcode is handled during the app upload process. If your app includes frameworks that are not properly stripped of bitcode, the upload may fail, resulting in errors that can be frustrating to troubleshoot. Furthermore, certain packages may not be optimized for the latest Xcode version, and older Flutter SDK versions might also contribute to this problem.

The Solution - Stripping Bitcode from Frameworks:

To resolve the uploading issue, you can use the bitcode_strip command-line tool to ensure that all necessary frameworks are stripped of their bitcode before the upload process. The best place to implement this solution is inside the post_install hook of your Podfile, making it applicable to all packages in your project.

# Find the path to the bitcode_strip utility
bitcode_strip_path = `xcrun --find bitcode_strip`.chop!

# Function to strip bitcode from a framework
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 of framework paths that require bitcode stripping
framework_paths = [
framework_paths = [
  "Pods/YourFramework1.xcframework/ios-arm64_armv7/YourFramework1.framework/YourFramework1",
  "Pods/YourFramework2.xcframework/ios-arm64_armv7/YourFramework2.framework/YourFramework2",
  # Add more frameworks as necessary
]

# Iterate over each framework and strip bitcode
framework_paths.each do |framework_relative_path|
  strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
end 

In my experience, I encountered uploading issues related to bitcode while using Facebook frameworks and the Flutter SDK with FVM in Xcode 16. Below are the steps I followed to effectively resolve the issue:

# Find the path to the bitcode_strip utility
bitcode_strip_path = `xcrun --find bitcode_strip`.chop!

# Function to strip bitcode from a framework
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 of framework paths that require bitcode stripping
framework_paths = [
  "Pods/FBAEMKit/XCFrameworks/FBAEMKit.xcframework/ios-arm64_armv7/FBAEMKit.framework/FBAEMKit",
  "Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64_armv7/FBSDKCoreKit.framework/FBSDKCoreKit",
  "Pods/FBSDKCoreKit_Basics/XCFrameworks/FBSDKCoreKit_Basics.xcframework/ios-arm64_armv7/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics",
  "Pods/FBSDKLoginKit/XCFrameworks/FBSDKLoginKit.xcframework/ios-arm64_armv7/FBSDKLoginKit.framework/FBSDKLoginKit",
  "../.fvm/flutter_sdk/bin/cache/artifacts/engine/ios-release/Flutter.xcframework/ios-arm64_armv7/Flutter.framework/Flutter",
]

# Iterate over each framework and strip bitcode
framework_paths.each do |framework_relative_path|
  strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
end 

Conclusion:

This solution provides a straightforward way to resolve the uploading issues related to bitcode in Xcode 16 for all packages. By stripping bitcode from the necessary frameworks, you can avoid errors during the upload process and ensure that your app meets the submission requirements.

Keep in mind that these issues can also arise from specific packages or older versions of the Flutter SDK, so it’s essential to keep your dependencies updated.

If you have any questions or need further assistance, feel free to reach out! I hope this tutorial helps you successfully upload your apps without any hitches.

Feel free to customize any part of the tutorial to better suit your style or requirements!

Fixing Xcode 16 Issue: Forked flutter_inappwebview and my_fatoorah as Workarounds

Start your project

Tell us what you need. We will reply with next steps.

  • Usually a reply within one business day
  • A clear price before work starts
  • You own the code