I have been working on one app in iOS platform where it need of display HTML files in WebView. Where my UIWebview is not working same as like browsers result.
i.e., Created folder reference in my xcode project and got the bundle path of the HTML file and loaded in UIWebView with NSURLRequest.
Is there any other way to run the HTML file in UIWebView like iphonehttpserver, GCDWebServer(But I am unable to get the demo code to start my server to achieve my requirement)
This is the code where I used to get HTML file path from resource bundle and loading in UIWebView (Folder name "assets" in which I have "web-app.html" file):
Objective-c:
- (void)viewDidLoad
{
[super viewDidLoad];
[self loadWebview];
}
- (void)loadWebview
{
NSString *htmlPath = [[NSBundle mainBundle] pathForResource:@"web-app" ofType:@"html" inDirectory:@"assets"];
NSURL *url = [NSURL fileURLWithPath:htmlPath];
[webVW loadRequest:[NSURLRequest requestWithURL:url]];
}
We found the issue, there was one servers.json file missing at our end. Because of that HTML unable to get the response to display the appropriate result.