Reputation: 12459
I want to add a Broadcast Upload Extension
to an existing swift native app. This extension is used for capturing the contents of the user's screen
like screen sharing
.
Purpose:
I am adding Jitsi Meet SDK
for video calling in my app. And this SDK requires a broadcast upload extension
to enable the screen sharing option.
What I have tried:
I tried to add a broadcast upload extension
with a new app and copy all the configuration into my existing app.
Steps of copying configuration from new app to existing app:
Copy files Atomic.swift
, DarwinNotificationCenter.swift
, SocketConnection.swift
from broadcast extension folder of screen sharing sample given in Jitsi Meet SDK
sample project. Here
Added .entitlements
file as per the above link of Jitsi Meet SDK sample
Added the group key in the .entitlements
file in the main project folder group
.entitlements
file In main project folder group :
<key>com.apple.security.application-groups</key>
<array>
<string>group.com.jitsi.example-screensharing.appgroup</string>
</array>
NSExtension
key and its content from the new app to the existing one in info.plist
file.microphone, camera & local network
in the existing app in info.plist
file.RTCScreenSharingExtension
& RTCAppGroupIdentifier
in the existing app in info.plist
file.info.plist
(point 5):
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.broadcast-services-upload</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SampleHandler</string>
<key>RPBroadcastProcessMode</key>
<string>RPBroadcastProcessModeSampleBuffer</string>
</dict>
info.plist
(point 6):
<key>NSMicrophoneUsageDescription</key>
<string>This will allow you to use microphone to record audio messages and join ${PRODUCT_NAME} meetings</string>
<key>NSLocalNetworkUsageDescription</key>
<string>Local network access is needed for P2P connections.</string>
<key>NSCameraUsageDescription</key>
<string>This lets you do things like take a photo and set it as your profile picture or share photos and videos with other team members within your workspace.
</string>
info.plist
(point 7):
<key>RTCScreenSharingExtension</key>
<string>com.jitsi.example-screensharing.broadcast.extension</string>
<key>RTCAppGroupIdentifier</key>
<string>group.com.jitsi.example-screensharing.appgroup</string>
Error:
Getting an error in an existing app that
Multiple commands produce '/Users/UserName/Library/Developer/Xcode/DerivedData/project-name-cgxqvnvmumzlucbokufvjzcnobpn/Build/Products/Debug-iphonesimulator/project-name.app/Info.plist':
1) Target 'project-name' (project 'project-name') has copy command from '/Users/Username/workspace/github/project-name/project-name/Info.plist' to '/Users/Username/Library/Developer/Xcode/DerivedData/project-name-cgxqvnvmumzlucbokufvjzcnobpn/Build/Products/Debug-iphonesimulator/project-name.app/Info.plist'
2) Target 'project-name' (project 'project-name') has process command with output '/Users/Username/Library/Developer/Xcode/DerivedData/project-name-cgxqvnvmumzlucbokufvjzcnobpn/Build/Products/Debug-iphonesimulator/project-name.app/Info.plist'
Upvotes: 2
Views: 1345
Reputation: 56
After trying numerous solutions, I discovered that the fix was surprisingly simple. It all came down to adjusting the build phases in the correct order.
To resolve the issue, arrange the build phases as shown in the following image:
This minor adjustment should resolve the problem. Sometimes, the simplest solutions are the most effective!
Upvotes: 0