Reputation:
I'm having a problem with opening a URL in WebView. Haven't programed with objective-c in awhile and it looks like what I'm coding has depreciated. The application opens, loads the URL but crashes with this error
Thread 1:EXC_BAD_ACCESS (code=1, address=0x20)
I originally used this to help me program in the past: [How to load URL on launch in a WebView (OSX project)?
Here's the code:
AppDelegate.h
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface AppDelegate : NSObject <NSApplicationDelegate> {
WebView *myWebView;
}
@property
(retain, nonatomic) IBOutlet WebView *myWebView;
@end
AppDelegate.m
#import "AppDelegate.h"
#import <WebKit/WebKit.h>
@implementation AppDelegate
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSString *urlText = @"http://google.com";
[[self.myWebView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlText]]];
return;
// Insert code here to initialize your application
}
@end
I receive a warning in AppDelegate.m before I build
Autosynthesized property 'myWebView' will use synthesized instance variable '_myWebView', not existing instance variable 'myWebView'
How can I fix this?
Upvotes: 0
Views: 2670
Reputation: 231
For second part of your question, that is for opening a URL in webview there is a fork of phoneGap(http://phonegap.com) called Macgap available. you can check that out here, http://github.com/maccman/macgap
Upvotes: 1
Reputation: 9392
Delete your declaration of WebView *myWebView;
insider your curly brackets, that's not necessary.
Upvotes: 0