In my app a user can share a result file (.pdf) or log files (.txt). After updating to iOS 16, one user called to say it did not work with "Save to Files". I confirmed this on iPhone with 16.0.3 and also on iPad with 16.2 (beta). I also checked and found this working as expected on iPad with 15.6.1, and also on iPhone with 12.5.6.
When I call uiactivityviewcontroller I have two items: a URL(fileURLWithPath: path), and a String. If the user selects Mail, this String became the "message body". But, in iOS16, the call fails -- the file is not written, and the ActivityViewController stays up. In iOS15, the file is written, along with a file called "text" that has the "message body" text.
let msgBody = "Text to go into message body if an email"
let fileURL = URL(fileURLWithPath: filePath)
let ac = UIActivityViewController(activityItems: [fileURL, msgBody],
applicationActivities: nil)
if UIDevice.current.userInterfaceIdiom == .pad {
ac.popoverPresentationController?.sourceView = UIView()
present(ac, animated: true, completion: nil)
} else {
present( ac, animated: true)
}
Why has this changed from iOS/iPadOS 15 to 16?