colossal-manchester-31772
10/04/2025, 12:20 AMtall-airline-16756
10/04/2025, 12:20 AMtall-airline-16756
10/04/2025, 12:21 AMSampleHandler.swift content in your Broadcast Upload Extension with this code:
import LiveKit
#if os(iOS)
@available(macCatalyst 13.1, *)
class SampleHandler: LKSampleHandler {
override var enableLogging: Bool { true }
}
#endif
This snippet uses the LKSampleHandler class, which conveniently manages socket communication and ReplayKit integration for you.
1. Make sure that both your main app and the extension are part of the same App Group. You can do this by adding the App Groups capability in Xcode under Signing & Capabilities, and using the same identifier (for example, group.com.example.myapp).
2. Double-check that the Broadcast Upload Extension is embedded in your main app. You can find this under "Embed App Extensions" in the Build Phases tab.
3. Remember, screen sharing doesn’t require camera access because ReplayKit handles screen capture independently. So, no camera permissions are needed in your extension.
4. To help with debugging, enable logging in SampleHandler.swift. This way, you can monitor logs easily using the macOS Console app.
If you run into any specific errors or if something isn’t clear, please feel free to share the exact log messages or describe what you’re seeing. I’m here to help you through this!
Sources: Sources/LiveKit/Broadcast/LKSampleHandler.swift | example/ios/LiveKit Broadcast Extension/Info.plist | Camera & microphone | LiveKit Docscolossal-manchester-31772
10/04/2025, 12:23 AMtall-airline-16756
10/04/2025, 12:23 AMcolossal-manchester-31772
10/04/2025, 12:25 AMtall-airline-16756
10/04/2025, 12:25 AMsharedApplication API isn’t available in iOS App Extensions. This is a common limitation since extensions run in a sandboxed environment and can’t access some APIs designed for full apps.
To help you get past this, make sure the LiveKit pod is included only in your main app target—not in the Broadcast Upload Extension target. You can set this up in your Podfile like this:
target 'MainAppTarget' do
pod 'LiveKit'
end
target 'BroadcastExtensionTarget' do
# Do not include LiveKit here
end
The Broadcast Upload Extension should use the shared socket communication from the main app, so it doesn’t need to include the LiveKit SDK directly. If anything’s unclear or you want a hand with this setup, just let me know—I’m here to help!colossal-manchester-31772
10/04/2025, 12:26 AMtall-airline-16756
10/04/2025, 12:27 AMSampleHandler.swift file. Confirm that it imports LiveKit and inherits from LKSampleHandler like this:
import LiveKit
@available(macCatalyst 13.1, *)
class SampleHandler: LKSampleHandler {
override var enableLogging: Bool { true }
}
1. Also, check your extension’s Info.plist file. The NSExtensionPrincipalClass key should be set to $(PRODUCT_MODULE_NAME).SampleHandler.
2. Remember that both your main app and the extension need to share the same App Group. So, add the "App Groups" capability to both targets and use the same identifier (for example, group.com.example.myapp).
3. Finally, ensure the ReplayKit framework is linked to the extension target.
Once you’ve made these updates, try cleaning and rebuilding your project. If you’re still running into issues or if anything else pops up, please don’t hesitate to reach out—I’m here to help you through it!
Sources: LiveKitExample.xcodeproj/project.pbxproj | lib/src/track/options.dart | BroadcastExtension/Info.plist | ios/LiveKitReactNativeModule.swift | swift-frontend/BroadcastExtension/Info.plistcolossal-manchester-31772
10/04/2025, 12:31 AMtall-airline-16756
10/04/2025, 12:31 AMhttps://github.com/livekit/client-sdk-swift, then click Next.
5. Pick the version that works best for you—usually the latest stable release—and click Next.
6. Make sure the Broadcast Upload Extension target is checked in the list of targets to add the package to, then hit Finish.
After that, give your project a quick clean and rebuild to make sure the LiveKit module is all set up in your extension. If you run into any bumps or have questions along the way, just let me know—I’m here to help!