5

In the app, I am using a RPSystemBroadcastPickerView to start a system-wide screen recording. I need to react to the user starting screen record or dismissing the shown picker view. In both cases, the system view gets dismissed.

I assumed that dismissing the system picker view will trigger a viewDidAppear event on the currently shown view controller. This does not happen. I tried to test if the AppDelegate triggers applicationDidBecomeActive or applicationWillEnterForeground - again without success (this are triggered when user open control center).

Does anyone have a suggestion what else to try?

Milan Nosáľ
  • 19,169
  • 4
  • 55
  • 90

2 Answers2

0

Before iOS 13: hook RPSystemBroadcastPickerView containerVC

iOS 14.0 or later: Monitor the focus and out-focus events of the app

Rémi B.
  • 2,410
  • 11
  • 17
  • I would add the reasoning why these plist values would be applicable in this case. – Justicle Jul 11 '23 at 18:42
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Justicle Jul 11 '23 at 18:42
-2

You can achieve it indirectly using Timer and UserDefaults.

Start the Timer in ViewController from the main app and check for corresponding value change from Broadcast Extension.

 class SampleHandler: RPBroadcastSampleHandler {

    override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) {
       appGroupDefaults.set(true, forKey: appGroupUserDefaultKeys.isScreenBroadcastStarted.rawValue)
    }

    override func broadcastFinished() {
       appGroupDefaults.set(true, forKey: appGroupUserDefaultKeys.isScreenBroadcastStopped.rawValue)
    }
    
 }
Jeeva
  • 448
  • 1
  • 6
  • 18