I'm a very new iOS developer (I only started a few days ago), and I'm trying to utilize the WebViewJavascriptBridge class with a UIWebView that I've got on my Storyboard. Whenever I try to use it, I get an EXEC_BAD_ACCESS error.
The trouble lines seem to be:
- (void)viewDidLoad
{
[super viewDidLoad];
WebViewJavascriptBridge* bridge = [WebViewJavascriptBridge bridgeForWebView:webView handler:^(id data, WVJBResponseCallback responseCallback) {
NSLog(@"Received message from javascript: %@", data);
responseCallback(@"Right back atcha");
}];
webView.scrollView.bounces = NO;
[[UIApplication sharedApplication] setStatusBarHidden:YES];
NSString *path = [[NSBundle mainBundle] bundlePath];
path = [NSString stringWithFormat:@"%@/%s", path, "htdocs/index.html"];
NSURL *URL = [NSURL fileURLWithPath:path];
[webView loadRequest:[[NSURLRequest alloc] initWithURL:URL]];
}
To be exact, the last line. If I don't make that request, I don't get the error. I've tried it with a UIWebView created just in Objective-C, and still gotten the error, although maybe I did it wrong.
Any suggestions?
EDIT:
Method for storing webView is this code + reference outlet.
@interface mcViewController : UIViewController
{
IBOutlet UIWebView *webView;
}
@end