0

Can't save file from SwiftUI app. Xcode says

[NSExtension] Extension request contains input items but the extension point does not specify a set of allowed payload classes. The extension point's NSExtensionContext subclass must implement `+_allowedItemPayloadClasses`. This must return the set of allowed NSExtensionItem payload classes. In future, this request will fail with an error.
[ShareSheet] cancelled request - error: The operation couldn’t be completed. Invalid argument

Code which I was trying

let fileURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.appendingPathComponent(fileName)
let activityVC = UIActivityViewController(activityItems: [fileURL], applicationActivities: nil)
UIApplication.shared.windows.first?.rootViewController?.present(activityVC, animated: true, completion: nil)

0 Answers0