ReplayKit's RPSystemBroadcastPickerView not showing preferredExtension
Asked Answered
K

6

18

I am using RPSystemBroadcastPickerView to show a picker view, from which a user can select a broadcast service to record the screen. Based on documentation, preferredExtension should allow me to set which broadcast extension should the picker show.

The code is super simple:

let broadcastPickerView = RPSystemBroadcastPickerView(frame: CGRect(x: 0, y: 0, width: 51, height: 51))
view.addSubview(broadcastPickerView)
broadcastPickerView.preferredExtension = "com.milan.nosal.broadcast-extension"
broadcastPickerView.backgroundColor = .clear
broadcastPickerView.showsMicrophoneButton = false

where "com.milan.nosal.broadcast-extension" is the bundle identifier of the extension I want the picker to offer (I checked its correctness multiple times).

However, when the control is tapped, at first the pop up shows empty selection:

enter image description here

After you close it, and tap the control again, it shows the correct extension. This only happens when the app is installed (or reinstalled), after it shows, then it shows always.

Is this the iOS 12 beta bug, or am I doing something incorrectly? Can I "preregister" the extension to work around this?

EDIT:

After publishing the app, we encountered the same problem with our users, but this time not even tapping the control multiple times helps - the picker is always empty! It seems that the extension is installed correctly, because it can be launched from control center.

Running on official release now.

Kulp answered 13/9, 2018 at 11:30 Comment(4)
looks like it's a bug in final iOS 12 as well.Quartern
@MilanNosáľ any news about this? I experienced similar problem on iOS/iPadOS 13.3.1. First broadcasting is ok. Second broadcast in my case display my extension + Photos as other option. Microphone button for enable/disable is missing also in the second case. If i start broadcasting second time, the extension can not be stopped. It continues recording. Have you noticed similar experience?Christan
@Christan no news.. I haven't experienced it for a long time though.. if you have problems stopping it, the problem might be in your extension, but if it simply does not appear in the list, I am not sure about that.. but I would first try to properly end the broadcast in extension - it might be that you are not ending it correctly and theoretically that might cause the list not to show it the second timeMatteson
thanks for answer. I did not explained good. In second case there is my Extension + Photos as options. But my extensions is not working. You are right i should look at the extension how it is ending. I will post here update if i find something.Christan
A
4

I think it is the apple's bug, but it was fixed in iOS 12.2 after I tested it.

Aperture answered 12/4, 2019 at 2:42 Comment(0)
B
9

enter image description here

Note that this is for ANY iOS Version:

I just burned a full day on this. When you add the BroadCast extension, Apple will automatically add the highest possible iOS Version for the deployment target. You need to make sure this isn't higher than your physical device's iOS Version. You won't get any build errors, they just won't show your app in the broadcast extension list.

Banker answered 10/9, 2021 at 15:39 Comment(0)
A
4

I think it is the apple's bug, but it was fixed in iOS 12.2 after I tested it.

Aperture answered 12/4, 2019 at 2:42 Comment(0)
R
1

I have the same issue, looks like Xcode has some issues how to install broadcastExtension with you app. For me, It is related only for Debug mode. To see correct UI, try to enable broadcasting once in old way (control center -> deep touch -> start broadcast), after that in your BroadcastPickerView you will see correct UI (you are pushing iOS to update information about the extension). Cannot reproduce in release mode.

Reliance answered 15/10, 2018 at 14:45 Comment(4)
For us, this does not happen only in debug. If this was not happenning for us in production, I would not care.Matteson
@MilanNosáľ Do you have scenario, when once you are started broadcast in old way and after that you cannot reproduce the issue?Reliance
I really really do not want to tell all the users to first go to control center, etc. - that beats the whole purpose of RPSystemBroadcastPickerView which was supposed to help starting system-wide replay kit broadcast from within the app without having to go through control center..Matteson
As a fast way solution, I can suggest to you to do first showing of the picker view without 'preferredExtension' property to show all providers and for all other cases use 'preferredExtension' property. You can use UserDefaults to save information about first loading of the 'RPSystemBroadcastPickerView'. Any way you need to notify apple about the behavior on bugreport.apple.com. @MilanNosáľ .Reliance
A
1

You can find your exactly preferedExtension here:

image

When you add pickerView.preferredExtension exactly the Bundle Identifier, your app will be showed on the Recording App List. Hope this helps!

Apothecium answered 26/4, 2019 at 5:1 Comment(1)
I have added the extension, yet the picker shows nothing.Suetonius
C
-1

If I do not set ".preferredExtension", I see all extensions on the list. I tested on iOS12 GM.

Composer answered 14/9, 2018 at 0:32 Comment(2)
This does not answer the question - I need the preferedExtension property to work correctlyMatteson
With preferredExtension, replayKit does not provide a way to select extensions. Without preferredExtension, ReplayKit provide a way to select extensions from list. "preferred" is misleading word. It should be "targetExtension", because user does not have choice to select.Composer
K
-1

You add Broadcast Upload Extension into your project and get that Extension Bundle Identifier.

How to create Broadcast Upload Extension into your app?

Go to xcode - File - New - Target - Broadcast Upload Extension

Then Add this line into your app. when you created RPSystemBroadcastPickerView object.

broadCastPicker?.preferredExtension = "com.vikrant.YourApp.Extension"

Kadiyevka answered 30/1, 2021 at 15:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.