1

My iOS app has a share-extension where users can also upload Attachments. As those can be large, the upload is done using an URLSession with URLSessionConfiguration.background. After the upload is done, I'd like to show the user some kind of success-ui and chose a Notification for that purpose. So now in my completion block I am doing something like that:

let content = UNMutableNotificationContent()
content.body = "Success"

let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 0.5, repeats: false)
let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)

let center = UNUserNotificationCenter.current()
center.add(request)
print("This line is never called")

and as you can see in my sample code here, the app is stuck ad center.add(request). This method is just never completing?!? When calling it, I am on the main-thread, but also tried on other threads... always the same result

Does anybody have an idea why?

Georg
  • 3,664
  • 3
  • 34
  • 75

0 Answers0