Skip to content

iOS SDK 3.x Framework Size Reduction

Akshay Agarwal edited this page Aug 21, 2024 · 7 revisions

This guide provides steps to reduce the size of the iOS SDK by removing certain components that may not be essential for your use case. By following these instructions, you can optimize the SDK size by eliminating files related to specific features.

Steps to Reduce SDK Size

1. Download the Latest Frameworks

First, add the Webex SDK to your project using CocoaPods. Use the following command in your Podfile:

# Webex SDK - Webex Calling flavor
pod 'WebexSDK/Wxc','~> 3.13.0'

Then, run the pod install command to install the pods.

2. Remove Unnecessary Files

2.1. Remove AI Audio Codec File - Added from v3.12.0 release

1. Navigate to the wbxaecodec.xcframework directory:/Pods/WebexSDK/Frameworks/wbxaecodec.xcframework/ios-arm64/wbxaecodec.framework
2. Delete the ce_codec_lib_exports_723b8c1e_package_b1_v5.bin file:
	* This file is part of the Xcodec, an AI-based audio codec that provides better audio quality in high packet loss networks. It does not support PSTN calls.
	* Removing this file will result in the AI codec not being able to provide enhanced audio quality for non-PSTN calls.
    * **Size Gain:** Approx. 23MB per architecture.

2.2. Remove Virtual Background Files - Added from v3.2.0 release

1. Navigate to the WebexSDK.xcframework directory:/Pods/WebexSDK/Frameworks/WebexSDK.xcframework/ios-arm64/WebexSDK.framework
2. Delete the following files:
	• PortraitSeg.mlmodelc
	• PortraitSegNew.mlmodelc
	• wseFilter.metallib
	    * These files are used for the Virtual Background feature.
	    * Removing these files will result in the Virtual Background feature stopping working.
        * **Size Gain:** Approx. 7MB per architecture.

Example Directory Structure After Removal

After performing the above steps, the above directories should look like this:

  1. /Pods/WebexSDK/Frameworks/wbxaecodec.xcframework/ios-arm64/wbxaecodec.framework

wbxaecodec.framework

  1. /Pods/WebexSDK/Frameworks/WebexSDK.xcframework/ios-arm64/WebexSDK.framework

WebexSDK.framework

Total Size Reduction

By removing both the AI codec and Virtual Background files, you can achieve a total size reduction of approximately 30MB for one architecture (e.g., arm64).

Summary

By following these steps, you can significantly reduce the size of the iOS SDK for the Webex Calling flavor. However, be aware of the trade-offs, such as the loss of enhanced audio quality for non-PSTN calls and the Virtual Background feature. This optimization is particularly suited for specific use cases where these features are not required, allowing for a more streamlined and efficient application.

Stripping SDK Frameworks

NOTE: All frameworks are stripped from v3.7 onwards.

Webex iOS SDK comes with both iPhoneOS (arm64) and Simulator (x86_64) architectures to test it on both simulator and device while development but when the app is uploaded to the App Store only arm64 architecture is uploaded which is automatically taken care by cocoapods. If you wish to not use cocoapods to manage your dependencies please refer strip-architectures.sh script to remove the x86_64 architecture at the time of releasing your app.

  • WebexSDK.framework (v3.6.0) size: 486MB
  • WebexBroadcastExtensionKit.framework (v3.6.0) size: 2MB

Framework Size Reduction

To reduce the size of framework, follow the given steps:

  1. Navigate to frameworks folder inside Pods cd /Pods/WebexSDK/Frameworks
  2. Use following command to remove the debug symbols strip -N WebexSDK.framework/WebexSDK

After removing dSym you should see the size of frameworks reduced by more than half.

  • WebexSDK.framework (v3.6.0) size: 205MB
  • WebexBroadcastExtensionKit.framework (v3.6.0) size: 1MB

NOTE: For comparing size of Webex iOS SDK, please compare the TestFlight build so it only contains 1 architecture (arm64). Universal binary supports 2 architectures (arm64 and x86_64) currently.

References

Clone this wiki locally