By following the documentation, in Info.plist
I have added UIApplicationSupportsPrintCommand = true
, but when tapping the navigation item's title and selecting Print, printContent(_:)
is never called. On the other hand, when selecting Move, move(_:)
is called as expected. What's the problem?
The issue can be reproduced by using the code below in a newly created Xcode project with the App template.
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
navigationItem.title = "asdf"
navigationItem.documentProperties = UIDocumentProperties(url: URL(fileURLWithPath: "/asdf"))
navigationItem.titleMenuProvider = { suggestions in
return UIMenu(children: suggestions)
}
}
override func move(_ sender: Any?) {
print("move")
}
override func printContent(_ sender: Any?) {
print("printContent")
}
}