2

In my app, a website included in a folder. I tried to load it in webview using the following code:

self.wView.dataDetectorTypes = UIDataDetectorTypeLink;
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:NO];
    NSLog(@"%@",htmlFile);
    //NSData *pathData = [NSData dataWithContentsOfFile:htmlFile];
    //NSString *htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil];
    NSURL *url = [NSURL URLWithString:[htmlFile lastPathComponent] relativeToURL:[NSURL fileURLWithPath:[htmlFile stringByDeletingLastPathComponent] isDirectory:YES]];

    //(void)[NSURLConnection connectionWithRequest:req delegate:self];
    [self.wView loadRequest:[NSURLRequest requestWithURL:url]] ;

I get the file path in nslog. But in my webview, css and js files are not loading.

Please help me.

1 Answer 1

1

Simple Solution for this problem

Just select the option Create Folder references for any added folders while you are copying the Website folder into XCode

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.