How to load WebView in local files but external to mainBlundle? (iPhone app)

I wrote a script that uploads some HTML files to the Documents folder of my application! I want to load these files into my WebView, is it possible?

For example: If index.html is present in Documents folder, load it, otherwise load index.html in mainBundle!

Thanks to everyone who can help me!

+2


source to share


1 answer


Of course, just use:



[webview loadRequest: [NSURLRequest requestWithURL: [NSURL fileURLWithPath: [@"~/Documents/index.html" stringByExpandingTildeInPath]]]]

+1


source







All Articles