UIActivityViewController 在共享文件后关闭呈现视图控制器。这仅在 iOS 13+ 中发生。有没有永久的解决方案?更新到 iOS 13 后,其他应用程序似乎也存在此问题。
class VC : UIViewController {
@IBAction func moveFiles(_ sender: UIButton) {
let alertController = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet)
alertController.addAction(UIAlertAction(title: "Move", style: .default, handler: { action in
let activityController = UIActivityViewController(activityItems: urls, applicationActivities: nil)
if (UIDevice.current.userInterfaceIdiom == UIUserInterfaceIdiom.pad) {
activityController.popoverPresentationController?.sourceRect = sender.frame
activityController.popoverPresentationController?.sourceView = sender.superview
}
self.present(activityController, animated: true, completion: nil)
}))
}
}
Run Code Online (Sandbox Code Playgroud)