open an html file locally
I have started developing with iPhone less than one month ago. Im still following tutorials and guide books and in one of them I learnt how to open in Safari an URL with openURL.
I was just wondering if it is possible to open a local HTML file with openURL, I mean; I have a simple,static HTML file, added to my Resources folder in Xcode. Then, I try to open it using openURL but it seems that either it is not possible or I am not referencing the file properly. I have used these two options:
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"html"];
NSURL *url = [NSURL fileURLWithPath:filePath];
and
- (NSString *)dataFilePath:(NSString *)fileName
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
return [documentsDirectory stringByAppendingString:fileName];
}
filePath = [self dataFilePath:@"test.html"];
NSURL *url = [NSURL fileURLWithPath:filePath];
With both options I get a reference to my .app file, but I want the .html file in it.
Is it possible to do what Im trying?
Thank you and regards.
Mac Mini, iPhone OS 3.1.2