The ability of my applications to share a PDF file with another third-party application broke in iOS 11. It shows a shared leaflet, but when I decided to open it in another (third-party) application, it just rejects the shared leaflet and does nothing.
Things I confirmed:
- Delegation methods for willBeginSending and didEndSending are called
- Opening the first batch applications, such as Mail or Notes, works great
- The document collector is still in memory
- The preview view works fine, but then the sharing button from the preview will still not open third-party applications.
- I also tried to use
UIActivityViewController
. Sharing a URL gives the same behavior. Sharing raw data allows you to "Create a PDF" and then actually sharing this PDF file (but this user sucks).
Has anyone else experienced this or had any ideas on how to fix it?
Here is the complete sample application code that shows the problem. I created it in a new application with one view. There are only two buttons in a storyboard that are connected to two actions.
class ViewController: UIViewController {
var docController: UIDocumentInteractionController!
@IBAction func open(sender: UIButton) {
self.docController.presentOptionsMenu(from: sender.frame, in:self.view, animated:true)
}
@IBAction func check() {
print(self.docController)
}
override func viewDidLoad() {
super.viewDidLoad()
let url = Bundle.main.url(forResource: "OrderForm", withExtension: "pdf")!
self.docController = UIDocumentInteractionController(url: url)
self.docController.delegate = self
}
}
extension ViewController: UIDocumentInteractionControllerDelegate {
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
return self
}
func documentInteractionController(_ controller: UIDocumentInteractionController, willBeginSendingToApplication application: String?) {
print("will begin")
}
func documentInteractionController(_ controller: UIDocumentInteractionController, didEndSendingToApplication application: String?) {
print("did end")
}
}
I also filed an error with Apple (problem ID: 34772214)
source
share