【发布时间】:2014-07-29 04:18:40
【问题描述】:
当我尝试这段代码时,我得到了错误:
Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WebView", referenced from: objc-class-ref in AppController.o
webview=[[WebView alloc]initWithFrame:CGRectMake(0, 0, 100,30)];
NSString *url=@"http://www.google.com";
NSURL *nsurl=[NSURL URLWithString:url];
NSURLRequest *nsrequest=[NSURLRequest requestWithURL:nsurl];
[webview.mainFrame loadRequest:nsrequest];
[self.webViewMenuItem setView:webview];
webViewMenuItem 是一个通过 IBOutlet 链接的 NSMenuItem。
【问题讨论】:
-
不确定,但是你是否包含了 webkit 框架?
-
是的,包括 webkit。我发现有些人认为它应该有效,但没有成功的证据!
-
啊,我有它,但忘记在应用程序设置中链接框架!错误已经消失,但它没有加载页面..感谢指针
-
我不知道为什么 NSMenuItem 上没有 webview 的证据。有任何想法吗?谢谢!
-
我现在不在电脑附近.. 但是你能设置网络加载代理,看看它是否被加载了吗?由于谷歌有很多空白空间,它可能不适合框架
标签: objective-c macos cocoa nsmenuitem