开发者

UIWebview iPhone loading bundle resources

开发者 https://www.devze.com 2022-12-22 01:15 出处:网络
I\'m trying to load images from the bundle to a uiwebview. the code i\'m currently using is NSString *path = [[NSBundle mainBundle] bundlePath];

I'm trying to load images from the bundle to a uiwebview.

the code i'm currently using is

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 safari and an error message pops with 'Safari cannot open the file. The error was: "file is directory".'

if i set the baseURL as nil then the page loads correctly (although without the images).

Any suggestions?


Just installed the application onto an actual iphone - and it works correctly as expected, just in the iphone simulator UIWebView and bundle path doesn't work correctly.

0

精彩评论

暂无评论...
验证码 换一张
取 消