Bundling The Zoom SDK Within A Swift Package

Description
Our company has been given permission to bundle the Zoom SDK within our own SDK. We were able to successfully bundle the XCFramework into our Swift Package, however, we are having trouble with MobileRTCResources.bundle. Below is an example of our Package.swift file:

// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
    name: "OurPackage",
    platforms: [.iOS(.v12)],
    products: [
        .library(
            name: "OurPackage",
            targets: ["OurPackage", "MobileRTC"]),
    ],
    dependencies: [
        ...
    ],
    targets: [
        .target(
            name: "OurPackage",
            dependencies: [...],
            resources: [
               .copy("MobileRTCResources.bundle")]),
        .binaryTarget(
            name: "MobileRTC",
            path: "MobileRTC.xcframework"
        )
    ]
)

However, when we add this package as a dependency in a sample app and try to initialize the Zoom SDK, the app crashes because it cannot find the MobileRTCResources.bundle file. When initializing the SDK, the follow crash occurs:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSBundle initWithURL:]: nil URL argument'

If I manually add the bundle file to the Copy Bundle Resources build phase, the app won’t crash; however, having to do this manual step is not ideal since we would ideally like clients to be able to simply add our Swift Package without having to do any other manual project setup.

Would it be possible to modify the Zoom SDK so it works when bundled in a swift package? This link may help: Apple Developer Documentation

1 Like

Hey @dbianchi,

Thanks for using the dev forum!

I understand the issue here. In an ideal scenario, it would be nice if the SDK could be provided as a swift package itself. It took quite a while to move away from the Fat frameworks to an XCFramework, but there are ongoing efforts to update to best practices. I will submit an internal feature request for this one and let you know what I hear. I am happy, though, that it works in a swift package in some way.

Stay tuned.
Thanks!
Michael

1 Like