{"id":28,"date":"2008-09-30T16:51:20","date_gmt":"2008-09-30T20:51:20","guid":{"rendered":"httpss:\/\/www.powenko.com\/blog\/?p=28"},"modified":"2008-11-18T13:32:16","modified_gmt":"2008-11-18T17:32:16","slug":"iphone-uiwebview-could-it-load-a-local-file","status":"publish","type":"post","link":"https:\/\/www.powenko.com\/wordpress\/?p=28","title":{"rendered":"iphone, UIWebView, Could it load a local file? Yes, It can do"},"content":{"rendered":"<p>Can UIWebView can load and display a HTML from a local file at iPhone?<br \/>\nYes, It can working in my test case.<\/p>\n<p><strong>test case 1, loading a resroutce file. failed<\/strong><\/p>\n<div><code><br \/>\n- (void)viewDidLoad {<\/code><\/div>\n<p><code>NSString *pdfPath = [[NSBundle mainBundle] pathForResource:@\"index\" ofType:@\"html\"];<br \/>\nNSURL *url = [NSURL URLWithString:pdfPath];<br \/>\nNSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];<br \/>\n[myWebView loadRequest:urlRequest];<\/p>\n<p>}<\/p>\n<p><\/code><\/p>\n<p><strong>test case 2, loading a recource file. Working<\/strong><\/p>\n<div><\/div>\n<p><code>NSString *pdfPath2 = [[NSBundle mainBundle] pathForResource:@\"index\" ofType:@\"html\"];<br \/>\nNSURL *pdfURL = [NSURL fileURLWithPath:pdfPath2];<br \/>\nNSURLRequest *URLReq = [NSURLRequest requestWithURL:pdfURL];<br \/>\n[myWebView loadRequest:URLReq];<\/p>\n<p>\u00a0<\/p>\n<p><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Can UIWebView can load and display a HTML from a local  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/28"}],"collection":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=28"}],"version-history":[{"count":0,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/28\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.powenko.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}