I am working on the new version of swift 4 and i have the next issue, i can not show a ".pdf" on a UIWebView. First i migrated my project to the new version of Swift, then i had to solve the issue of "Set Swift 3 @objc inference to Default", then when i run my project just some of the PDFs i set when i was working on Swift 3 are showing, i added new ones after upgrade the swift but does not show it on the UIWebView. This is my code to show the pdf files:
func showCarPdf() {
print(carPdfView!)
if let pdf = Bundle.main.url(forResource: carPdfView!, withExtension: "pdf", subdirectory: nil, localization: nil) {
let req = NSURLRequest(url: pdf)
webView.loadRequest(req as URLRequest)
}
}
Does any one know whats happend? Why i can only show the files that i set on swift 3 and not the new ones added with the new version. Thanks a lot guys.
req
? Which steps did you try to debug the code? – Amin Negm-Awadreq
, because I saw the possibility that it is not found … – Amin Negm-Awad