Mc.Lover desires to attract extra consideration to this query.
I’m engaged on a macOS Catalyst app and want to avoid wasting a file utilizing UIActivityViewController. Nevertheless, the “Save” choice doesn’t seem once I current the exercise view controller. The file is supplied as a URL, and I’ve tried storing it each within the Paperwork listing and the short-term listing, however the difficulty persists. Curiously, the “Save” choice exhibits up accurately when the app runs within the “Designed for iPad” mode on macOS Catalyst. Beneath is the code snippet I’m utilizing:
struct ActivityViewController: UIViewControllerRepresentable {
@Binding var activityItems: [Any]
var applicationActivities: [UIActivity]? = nil
@Setting(.presentationMode) var presentationMode
func makeUIViewController(context: UIViewControllerRepresentableContext<ActivityViewController>) -> UIActivityViewController {
print(“ActivityViewController.makeUIViewController() – activityItems=(activityItems)”)
let controller = UIActivityViewController(activityItems: activityItems, applicationActivities: applicationActivities)
return controller
}
func updateUIViewController(_ uiViewController: UIActivityViewController, context: UIViewControllerRepresentableContext<ActivityViewController>) {}
}
File URL:
func macOSEncryptFile(at fileURL: URL, password: String) throws -> URL {
let fileManager = FileManager.default
let fileData = strive Information(contentsOf: fileURL)
let encryptedData = RNCryptor.encrypt(knowledge: fileData, withPassword: password)
let originalFileNameWithExtension = fileURL.lastPathComponent
let tempDirectoryURL = fileManager.temporaryDirectory
let encryptedFileURL = tempDirectoryURL.appendingPathComponent(originalFileNameWithExtension).appendingPathExtension(“crpt”)
strive encryptedData.write(to: encryptedFileURL)
return encryptedFileURL
}