开发者

No WebFrame methods are recognized by compiler

开发者 https://www.devze.com 2023-02-28 14:40 出处:网络
This is a Cocoa app I am working on. I\'m trying to embed a simple WebView with some basic content in an NSWindow in my app. I\'ve wired my WebView to my NSWindowController, and anytime I try to pass

This is a Cocoa app I am working on. I'm trying to embed a simple WebView with some basic content in an NSWindow in my app. I've wired my WebView to my NSWindowController, and anytime I try to pass a selector to that WebView, things are fine. But to load content, I need to use the WebFrame. And XCode refuses to recognize any methods in WebFrame (although it seems to recognize that WebFrame is a proper class.) For example:

[[webView mainFrame] loadHTMLString:htmlString baseURL:nil];

generates a 'loadHTMLString: baseURL:' not found compiler warning. It does function at runtime, but of course I'd like to eliminate the compiler warning.

Any thoughts on what's up?

Thanks in advance.

(Edited to add more code)

Below is from my ViewController's header file:

#import <Foundation/Foundation.h>
#import <WebKit/WebView.h>

@interface ReportViewController : NSWindowController {

   IBOutlet WebView *webView;

}

@property (nonatomic, assign) WebView *w开发者_运维技巧ebView;

And below here is a snippit from my Document implementation:

ReportViewController *window = [[ReportViewController alloc] initWithWindowNibName:@"Report"];
[window showWindow:nil];
WebView *webView = [window webView];
[htmlData writeToFile:tmpfile atomically:YES];


Thanks to Bavarious' hint, I realized that I needed to import <WebKit/WebKit.h> as opposed to <WebKit/WebView.h>.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号