This is my code:
-(void)viewDidLoad
{
[super viewDidLoad];
NSString *indexPath = [NSBundle pathForResource:@"iHelp" ofType:@"html" inDirectory:nil];
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:indexPath]]];
}
The app is crashing because ‘nil’ for directory name is invalid (DUH!). So for an imbedded html file, what should go there?
UPDATE: found that “webView” has no outlet, although one is defined in the .h file… will close this because I believe there is an answer here. Will open a new question re: the outlets… thanks everybody!
If the file
iHelpis in the main bundle, you can retrieve its path like this:You can also do that like the following: