0

I'm trying to load a local HTML file from my supporting files folder in my project... I keep getting this message... Thread 1: breakpoint 1.1 and I don't know why, my code for the web view is below

#import "WPViewController.h"

@interface UIViewController ()

@end

@implementation WPViewController

@synthesize viewWeb;

- (void)viewDidLoad {

[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html"  inDirectory:@"localHTML"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[viewWeb loadRequest:request];
}

 - (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}

- (IBAction)dismissView:(id)sender {
[self dismissModalViewControllerAnimated:YES];
}

@end

Header...

#import <UIKit/UIKit.h>

@interface WPViewController : UIViewController

@property (strong, nonatomic) IBOutlet UIWebView *viewWeb;

- (IBAction)dismissView:(id)sender;

@end

2 Answers 2

1

First, double check you haven't set any breakpoints that are stopping your app. You can disable/enable them using CMD+Y. Also, you can see if you have set any at all on the left pane -> Breakpoint Navigator tab.

Also, you should try to implement the UIWebViewDelegate protocol and override

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error

in your WPViewController so you can obtain some more info on why the page isn't being displayed.

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

Comments

0

try may be helped you..

- (void)viewDidLoad {

[super viewDidLoad];

NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"index" ofType:@"html" inDirectory:@"html_files"];

NSData *htmlData = [NSData dataWithContentsOfFile:htmlFile];
webView = [UIWebView alloc] init];
[webView loadData:htmlData MIMEType:@"text/html" textEncodingName:@"UTF-8" baseURL:[NSURL URLWithString:@""]];

}

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.