Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App size increased(almost doubled) with Xcode 14 and Bitcode Disabled

Apple has deprecated the usage of Bitcode and is longer accepting any submissions with Bitcode enabled apps starting from Xcode 14. We at PhonePe disabled Bitcode and uploaded the app to the App Store connect via Xcode 14 and now seeing a very high increase in the app size. Size of the app has almost doubled from 189 MB(with Xcode 13 and Bitcode enabled) to 342 MB with Xcode 14.

Is anyone facing similar issue or has any solution to decrease the app size?

Deprecations

  • Starting with Xcode 14, bitcode is no longer required for watchOS and tvOS applications, and the App Store no longer accepts bitcode submissions from Xcode 14.

  • Xcode no longer builds bitcode by default and generates a warning message if a project explicitly enables bitcode: “Building with bitcode is deprecated. Please update your project and/or target settings to disable bitcode.” The capability to build with bitcode will be removed in a future Xcode release. IPAs that contain bitcode will have the bitcode stripped before being submitted to the App Store. Debug symbols for past bitcode submissions remain available for download. (86118779)

  • Because bitcode is now deprecated, builds for iOS, tvOS, and watchOS no longer include bitcode by default. (87590506)

like image 933
Srikanth Avatar asked Sep 09 '25 20:09

Srikanth


2 Answers

Provided a fix for it. Our app size is back to normal as earlier.

So, when we have Bitcode enabled, Apple does the stripping of the symbols from our IPA and thus helps us with smaller app size. However, when we disable Bitcode, symbols are not stripped by default. There is no documentation by Apple which recommends us to strip the symbols from the binary for bitcode disabled apps. Stripping the symbols would take you back to the previous app size where things were all normal.

To strip the symbols, we can use this command.

strip -rSTx Binary -o StrippedBinary.

The T flag tells strip to remove Swift symbols, the other flags remove debugging and local symbols.

Steps to perform:

Once you generate an xcarchive, go to Show package Contents -> Products -> Applications -> YourAppName.app -> Show package contents. You will have YourAppName file. Run strip -rSTx YourAppName -o YourAppName to strip the symbols.

If you have other frameworks bundled inside your app, go to Frameworks folder and run the above strip command for all those framework files as well.

Here is a small script I have written which will help you to do it in one shot. Please change yourAppName.

#!/bin/bash

yourAppName=PhonePe
appFolder="$yourAppName.app"

echo "$appFolder"
cd $appFolder

strip -rSTx $yourAppName -o $yourAppName

cd Frameworks

for d in */ ; do
    IFS='. ' read -r -a array <<< "$d"
    newname=${array[0]}1
    
    strip -rSTx $d/${array[0]} -o $d/${array[0]}
done

Once the above script or stripping process is complete, you can proceed as-usual with distributing the app to App Store. Once Apple completes the processing of your build, you will see a very high reduction in the app size.

like image 82
Srikanth Avatar answered Sep 12 '25 12:09

Srikanth


Great article Xcode 14 unintentionally increases app size, I have added the script for each of my targets Strip Binary Symbols

Also if you are using CocoaPods add below script to podfile

post_install do |installer|
  installer.pods_project.build_configurations.each do |config|
    config.build_settings['STRIP_INSTALLED_PRODUCT'] = 'YES'
    config.build_settings['STRIP_STYLE'] = "all"
    config.build_settings['STRIPFLAGS'] = "-rSTx"
  end
end
like image 39
Ramesh R C Avatar answered Sep 12 '25 12:09

Ramesh R C