Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue importing LiveKit after following swift quick start live kit #574

Open
AlexanderGeorge102934 opened this issue Feb 4, 2025 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@AlexanderGeorge102934
Copy link

Describe the bug
Missing required module 'LKObjCHelpers' error when importing LiveKit

SDK Version
2.1.0

iOS/macOS Version
18.2

Xcode Version
16.0

Steps to Reproduce
Followed the Swift LiveKit quick start guide exactly in Xcode and pasted the code in the default main given on swift. Once I imported LiveKit I got the error thrown.

Expected behavior
No error to be thrown when I copy paste the example code given into main

Screenshots
N/A

Logs
N/A

@AlexanderGeorge102934 AlexanderGeorge102934 added the bug Something isn't working label Feb 4, 2025
@hiroshihorie
Copy link
Member

Just tried with a fresh project with Xcode16.2 and it was ok.
Will try with 16.0.

Does it happen with a fresh project?

@AlexanderGeorge102934
Copy link
Author

Yes I used a fresh project

@ladvoc
Copy link
Contributor

ladvoc commented Feb 4, 2025

I tested this in Xcode 16.0 but was unable to reproduce the issue. If you haven’t already, please try clearing Xcode’s derived data, as this can sometimes resolve phantom build errors. Please let me know if this resolves the error.

@AlexanderGeorge102934
Copy link
Author

I'm still experiencing the issue. I even created another fresh project.

@henry-castalk
Copy link

henry-castalk commented Feb 11, 2025

@AlexanderGeorge102934 I got this same issue. I used CocoaPods as the dependency manager. I still use Xcode version 15.4.

I have a workaround solution. It’s a little bit dirty, but it worked on my side.
Since the error is Missing required module 'LKObjCHelpers' when importing LiveKit, the main idea is to import the folder LKObjCHelpers as a dependency module of LiveKit.

Here is the detail. Hope it works for you.

Step 1. In the directory which contains the Podfile, I created two other podspec files, one for LiveKitClient, one for LKObjCHelpers

File: LKObjCHelpers.podspec

Pod::Spec.new do |spec|
    spec.name = "LKObjCHelpers"
    spec.version = "2.1.0"
    spec.summary = "LiveKit Swift Client SDK. Easily build live audio or video experiences into your mobile app, game or website."
    spec.homepage = "https://github.com/livekit/client-sdk-swift"
    spec.license = {:type => "Apache 2.0", :file => "LICENSE"}
    spec.author = "LiveKit"

    spec.ios.deployment_target = "13.0"
    spec.osx.deployment_target = "10.15"

    spec.swift_versions = ["5.7"]
    spec.source = {:git => "https://github.com/livekit/client-sdk-swift.git", :tag => "2.1.0"}

    spec.source_files = "Sources/LKObjCHelpers/**/*.{h,m}"
    spec.public_header_files = "Sources/LKObjCHelpers/include/**/*.h"

    # Move the header file to the same directory as the .m file, so the import inside .m file could work.
    spec.prepare_command = <<-SCRIPT
      find Sources/LKObjCHelpers/include -type f -name '*.h' -exec mv {} Sources/LKObjCHelpers/ \\;
      rmdir Sources/LKObjCHelpers/include || true
    SCRIPT
  end

File: LiveKitClient.podspec

Pod::Spec.new do |spec|
    spec.name = "LiveKitClient"
    spec.version = "2.1.0"
    spec.summary = "LiveKit Swift Client SDK. Easily build live audio or video experiences into your mobile app, game or website."
    spec.homepage = "https://github.com/livekit/client-sdk-swift"
    spec.license = {:type => "Apache 2.0", :file => "LICENSE"}
    spec.author = "LiveKit"
  
    spec.ios.deployment_target = "13.0"
    spec.osx.deployment_target = "10.15"
  
    spec.swift_versions = ["5.7"]
    spec.source = {:git => "https://github.com/livekit/client-sdk-swift.git", :tag => "2.1.0"}
  
    spec.source_files = "Sources/**/*"
  
    spec.dependency("LiveKitWebRTC", "= 125.6422.16") # Update the correct version
    spec.dependency("SwiftProtobuf")
    spec.dependency("Logging")
    spec.dependency("LKObjCHelpers") # Import this as dependency
  
    spec.resource_bundles = {"Privacy" => ["Sources/LiveKit/PrivacyInfo.xcprivacy"]}
  
    # Add the following lines to enable the experimental feature
    spec.pod_target_xcconfig = {
      'OTHER_SWIFT_FLAGS' => '-enable-experimental-feature AccessLevelOnImport'
    }
  end

Update the Podfile to install LiveKit using these local files.

...
pod 'LiveKitWebRTC', :podspec => 'https://raw.githubusercontent.com/livekit/webrtc-xcframework/refs/tags/125.6422.16/LiveKitWebRTC.podspec'
pod 'LKObjCHelpers', :podspec => './LKObjCHelpers.podspec'
pod 'LiveKitClient', :podspec => './LiveKitClient.podspec'
...

Step 2. Run pod install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants