Reputation: 5234
After looking up information regarding loading offline resources into UIWebView, it looks like I'm out of luck for any easy solution.
I can load my main html file very easily by doing the following
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"tour" ofType:@"html"]isDirectory:NO]]];
The problem is that all the images/etc inside that are inside folders in my resources do not load. If it is in the top level like tour.html is, then it does load.
The paths simply do not behave like paths as if it was on a server.
Upvotes: 1
Views: 690
Reputation: 4604
When you drag a folder of resources to XCode, select "Create folder references for any added folders" rather than the default "Create groups for any added folders".
Your folder icon will appear as blue - not yellow, which means it is a reference to the actual physical folder on disk.
It will then preserve its structure when added into the bundle.
Upvotes: 2