iOS
Calls Key Functions Advanced

Advanced

This page contains the following information:

  • Custom thread handling: how to designate and create a thread for the Calls SDK.
  • WebRTC famework and Bitcode: how to use bitcode when building Sendbird Calls' WebRTC framework.

Custom thread handling

You can designate and create a specific thread for the Calls SDK. For example, the SendBirdCall instance can call the delegate methods of the SendBirdCallDelegate and DirectCallDelegate on a custom background thread to keep your main thread running without disruption.

To specify a thread of your choice, call SendBirdCall.executeOn(queue: YOUR_QUEUE). If a thread to run on isn’t specified, the SendBirdCall instance will run asynchronously on the DispatchQueue.main.

Note: However, because PushKit is designed to require immediate and synchronous handling of event callbacks, the completion handler of the SendBirdCall.pushRegistry(_:didReceiveIncomingPushWith:for:completion:) and the SendBirdCallDelegate.didStartRinging(_) method will run synchronously on the thread that you called them. In other words, these two are not allowed to run on the thread you specified in the SendBirdCall.executeOn(queue:) method.


WebRTC framework and Bitcode

Sendbird Calls uses the custom-built WebRTC framework to provide internet-based communication. The default WebRTC framework from Google does not have bitcode enabled, so when you try to build it with your bitcode-enabled app, errors will return. However, our custom-built WebRTC framework called SendBirdWebRTC is bitcode-enabled and about 1GB in size. If your loaded SendBirdWebRTC framework is smaller than that, check your Git Large File Storage settings and download again.

Can I reduce the size of the framework?

If you don’t plan to use bitcode, you can choose to use bitcode-disabled framework to save development time during the development phase.

The SendBirdWebRTC framework has the following architectures: x86_64, i386, armv7, and arm64. To extract the framework which runs on a specific architecture, use the following command in the WebRTC.framework directory.

Light Color Skin
Copy
lipo WebRTC -extract ARCHITECTURE -o OUTPUT_FILENAME

To remove bitcode from the framework, use the following command in the WebRTC.framework directory.

Light Color Skin
Copy
xcrun bitcode_strip -r WebRTC -o OUTPUT_FILENAME

If you can’t download the SendBirdWebRTC framework, use GoogleWebRTC temporarily but the Calls SDK may not function properly.