How do we detect SCContentSharingPicker is cancelled?

Hello,

I am trying to make use of SCContentSharingPicker for my app and I wonder how I can detect a close event of SCContentSharingPicker.

I could open the picker screen with following simple code:

SCContentSharingPicker.shared.isActive = true
SCContentSharingPicker.shared.add(self)
SCContentSharingPicker.shared.present()

And I closed it with "Cancel" button located at the top right corner. Initially I was expecting to get a event through an observer like below but realised that it's called when a stream is canceled.

extension ContentPickerButton: SCContentSharingPickerObserver {
    
    func contentSharingPicker(_ picker: SCContentSharingPicker, didCancelFor stream: SCStream?) {
        logger.info("Picker canceled for stream \(stream)")
    }

I would like to get a picker close event so that I can deactivate the picker. (Otherwise, camera icon will stay alive at the tray.)

How do we get a close event?

Answered by Engineer in 801082022

The header file for contentSharingPicker(_:didCancelFor:) mentions that this is

the observer callback method when the picker has been canceled with no selection.

I can reproduce the behavior you are describing and it is unexpected. Please use Feedback Assistant to submit a bug report and please post here the ID generated by Feedback Assistant.

Accepted Answer

The header file for contentSharingPicker(_:didCancelFor:) mentions that this is

the observer callback method when the picker has been canceled with no selection.

I can reproduce the behavior you are describing and it is unexpected. Please use Feedback Assistant to submit a bug report and please post here the ID generated by Feedback Assistant.

How do we detect SCContentSharingPicker is cancelled?
 
 
Q