我试图制作一个显示google页面的webview,但是如果我运行我的程序,它将崩溃。
我在.h中的代码:
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface AppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@property (weak) IBOutlet WebView *myWebView; //here I want to show google.com
@end
我在.m中的代码:
#import "AppDelegate.h"
@implementation AppDelegate
@synthesize myWebView;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
[self loadWeb];
}
-(void)loadWeb {
[[webv mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString: @"http://www.google.de"]]]; // here I want to load the page
}
@end
问题总是说:
int main(int argc,char argv [])
{
返回NSApplicationMain(argc,(const char *)argv); //绿色标记:线程1:信号SIGABRT
}
最佳答案
你有没有尝试过:
#import <WebKit/WebView.h>
#import <WebKit/WebKit.h>
关于macos - webView不适用于osx,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12446130/