gpt4 book ai didi

objective-c - 是否可以将 webview 加载到 OS X 中的 NSMenuItem 中?

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

当我尝试这段代码时,出现错误:体系结构 x86_64 的 undefined symbol :“_OBJC_CLASS_$_WebView”,引用自:AppController.o 中的 objc-class-ref

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。

最佳答案

好的,为了完成这个问题:

Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_WebView", referenced from: objc-class-ref in AppController.o

那是因为Webkit框架没有添加到项目中。

Is it possible to load a webview into a NSMenuItem in OS X

是的,这是可能的,但请确保在父 View 完全加载完成后加载 WebView 。

关于objective-c - 是否可以将 webview 加载到 OS X 中的 NSMenuItem 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25008185/

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