-UIApplication.shared.openURL(url)
-UIApplicartion.shared.open(url,options: [:],completionHandler: nil)
Run Code Online (Sandbox Code Playgroud)
我可以在iOS9和iOS10中使用这两个选项吗?
UIApplication.shared.openURL(url)iOS9和/或iOS10 是否受支持?
import UIKit
import WebKit
class ViewController: UIViewController, UIDocumentInteractionControllerDelegate {
var docController: UIDocumentInteractionController!
override func viewDidLoad() {
super.viewDidLoad()
docController = UIDocumentInteractionController.init(url: URL(fileURLWithPath: NSTemporaryDirectory()).appendingPathComponent(urlVal!))
docController.delegate = self
docController.presentPreview(animated: true)
}
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
return self
}
}
Run Code Online (Sandbox Code Playgroud)
上面的代码我无法显示pdf文件。有人可以帮忙吗?