gpt4 book ai didi

macos - webView不适用于osx

转载 作者:行者123 更新时间:2023-12-03 17:40:02 25 4
gpt4 key购买 nike

我试图制作一个显示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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com