Banner of local notification from broadcast upload extension may not work.

Hi.

I implemented a broadcast upload extension and it requests local notifications.

The local notification works normally on broadcastStarted(withSetupInfo:), but the Banner of the local notification does not work on processSampleBuffer(_: with:) though its Notification Center works normally.

What am I missing?

Here is my code snippets.

  • container app
class AppDelegate: NSObject, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
 
        requestAuthorization()
        ...
}

    private func requestAuthorization() {
        let center = UNUserNotificationCenter.current()
        center.requestAuthorization(options: [.alert]) { granted, error in
             
            if let error = error {
                // Handle the error here.
                print(error)
            }
            if granted == true {
                center.delegate = self
                center.getNotificationSettings(completionHandler: { setting in
                    print(setting)
                })
            }
            else {
                print("not permitted")
            }
        }
    }
}
  • upload extension
class SampleHandler: RPBroadcastSampleHandler {
    override func broadcastStarted(withSetupInfo setupInfo: [String : NSObject]?) {
        super.broadcastStarted(withSetupInfo: setupInfo)

        notification(title: "Upload Extension", body: "broadcastStarted")
        ...
    }

    override func processSampleBuffer(_ sampleBuffer: CMSampleBuffer, with sampleBufferType: RPSampleBufferType) {
        super.processSampleBuffer(sampleBuffer, with: sampleBufferType)
        ...
        if some condition {
            notification(title: "Upload Extension", body: "processSampleBuffer")
        }
    }

    private func notification(title: String, body: String) {
        let content = UNMutableNotificationContent()
        content.title = title
        content.body = body
        let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: nil)
        let notificationCenter = UNUserNotificationCenter.current()
        notificationCenter.add(request) { error in
           if error != nil {
              print(error)
           }
        }
    }
}

Were you able to find a solution to this?

I had flied this issue via Feedback Assistant on 2022/09/20.(FB11549664) No response yet.

Now I noticed that this issue was not posting. Any notification banners, such as timer alert, are prevented during my broadcast upload extension is running.

Do I need special settings of the extension to allow banners?

Banner of local notification from broadcast upload extension may not work.
 
 
Q