0

I have been working on ios app which now i am facing some problems. I want to load some files like docx, xls using UIWebView. It gets me white screen on my actual device.

@IBOutlet weak var fileServerWebView: UIWebView!
override func viewDidLoad() {
    super.viewDidLoad()

    if let path = Bundle.main.path(forResource: "easychair", ofType: "docx"){
        let targetUrl: URL = URL(fileURLWithPath: path)
        let request = URLRequest(url: targetUrl as URL)
        fileServerWebView.delegate = self
        fileServerWebView.scalesPageToFit = true
        fileServerWebView.loadRequest(request)
    }else{
        print("cannot get path")
    }

    // Do any additional setup after loading the view.
}

That is code that i tried to load that file from local. Thank you for your help.

Visal Sambo
  • 1,270
  • 1
  • 19
  • 33

0 Answers0