在现有应用中添加广播上传扩展

发布于 2025-02-07 05:37:13 字数 3849 浏览 0 评论 0原文

我想将广播上传扩展名添加到现有的Swift本机应用程序中。此扩展名用于捕获用户屏幕的内容,例如屏幕共享

目的:

我正在添加jitsi Meets sdk在我的应用中进行视频通话。此SDK需要一个广播上传扩展才能启用屏幕共享选项。

我尝试过的内容:

我尝试使用新应用程序添加广播上传扩展,然后将所有配置复制到我现有的应用中。

将配置从新应用程序复制到现有应用的步骤:

  1. 复制文件atomic.swiftdarwinnotificationcenter.swiftsocketconnection.swift.swift从广播中JITSI中给出的屏幕共享样本的扩展文件夹Meet SDK示例项目。

  2. 根据jitsi Meeting SDK示例

    的上述链接,添加了.entiTlements文件
  3. .entitlement项目文件夹组

在主项目文件夹中的主项目文件夹组

<key>com.apple.security.application-groups</key>
    <array>
        <string>group.com.jitsi.example-screensharing.appgroup</string>
    </array>
  1. 。它的内容从新应用到info.plist文件中的现有应用程序。
  2. 给予麦克风,相机&amp;本地网络info.plist文件中的现有应用中。
  3. 添加键rtcscreensharingextension&amp; rtcappGroupidentifierinfo.plist文件中的现有应用中。

info.plist(点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(点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(点7):

<key>RTCScreenSharingExtension</key>
<string>com.jitsi.example-screensharing.broadcast.extension</string>
<key>RTCAppGroupIdentifier</key>
<string>group.com.jitsi.example-screensharing.appgroup</string>

错误:错误:

在现有应用中遇到错误

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'

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:

  1. Copy files Atomic.swift, DarwinNotificationCenter.swift, SocketConnection.swift from broadcast extension folder of screen sharing sample given in Jitsi Meet SDK sample project. Here

  2. Added .entitlements file as per the above link of Jitsi Meet SDK sample

  3. 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>
  1. Copy the NSExtension key and its content from the new app to the existing one in info.plist file.
  2. Give permissions to the microphone, camera & local network in the existing app in info.plist file.
  3. Add keys 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'

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

刘备忘录 2025-02-14 05:37:13

在尝试了许多解决方案之后,我发现该修复程序非常简单。这一切都归结为以正确的顺序调整构建阶段。

要解决问题,请如下图所示排列构建阶段:

“在此处输入图像说明”

此次要调整应解决问题。有时,最简单的解决方案是最有效的!

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:

enter image description here

This minor adjustment should resolve the problem. Sometimes, the simplest solutions are the most effective!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文