Search code examples
iosswiftreplaykit

App not showing up as a broadcast service in RPBroadcastActivityViewController


I'm trying to use Replaykit to start a broadcast session (recording the App screen works ok) and it opens up a picker from where broadcasting Apps can be picked, Youtube, Facebook and Periscope show up but not my App, code:

if #available(iOS 10.0, *) {
  RPBroadcastActivityViewController.load { broadcastAVC, error in
    guard error == nil else {
      print("Cannot load Broadcast Activity View Controller.")
      return
    }
    if let broadcastAVC = broadcastAVC {
      broadcastAVC.delegate = self
      self.viewController.present(broadcastAVC, animated: true, completion: {
        // broadcastactivityviewcontroller will perform the callback when the broadcast starts (or fails)
      })
    }
  }
}

Full source code here, the code is in the startBroadcast function.

I also tried loading using withPreferredExtension and it says preferred broadcast service not found. When I go to the control centre to try starting a broadcast session I see no Start Broadcast button and no Apps, just Start Recording, I'm using IOS11 so I tried with a phone using IOS12 and same result concerning control centre. How can I get my App to show in the picker, thanks?


Solution

  • Had to add the Broadcast Extension, in Xcode, File -> New -> Target -> Broadcast Upload Extension. This extension was then displayed in the picker.