iosswiftbroadcastscreensharingrpbroadcastsamplehandler

In SampleHandler class for BroadcastUploadExtension, my broadcastFinished method not calling but broadcastStarted is calling, someone help me


I created a BroadcastUploadExtension. Afterwards, I opened the recording screen, but I did it by simulating clicking into the RPSystemBroadcastPickerView like this:

let picker = RPSystemBroadcastPickerView(frame: frame)
        if let url = Bundle.main.url(forResource: "ScreenBroadcast", withExtension: "appex", subdirectory: "PlugIns") {
            if let bundle = Bundle(url: url) {
                picker.preferredExtension = bundle.bundleIdentifier
                
                self.window.rootViewController?.view.addSubview(picker)
                
                if let button: UIButton = picker.subviews.first(where: {view in view is UIButton}) as? UIButton {
                    button.sendActions(for: .touchUpInside)

Then I start the recording from here:

pressing picker view

In Sample Handler that extension created: broadcastStarted() method is calling when I start recording but broadcastFinished() method not calling. So how can I know that broadcast is finished. I am expecting that when a user tap stop recording in recording center(the image above) it should call broadcastFinished() method. Btw I am checking it with UserDefaults by saving and checking if it is called.


Solution

  • It turns out that I should have create App group with my main app bundle identifier with "group." prefix. I used my extension's identifier earlier.