UIWebview Resources for iPhone Download

I am trying to upload images from a package in uiwebview.

the code I'm using right now

NSString *path = [[NSBundle mainBundle] bundlePath]; NSURL *baseURL = [NSURL fileURLWithPath:path]; [webView loadHTMLString:htmlString baseURL:baseURL]; 

when I open the view, the application closes and opens the safari, and an error message appears: "Safari cannot open the file. Error:" file is directory ".

if I set baseURL to nil, then the page loads correctly (although without images).

Any suggestions?

+4
source share
1 answer

Just install the application on a real iphone - and it works correctly, as expected, only in the iphone simulator. The UIWebView and bundle interface does not work correctly.

+1
source

Source: https://habr.com/ru/post/1303437/


All Articles