我在 Apple 网站上尝试使用 WebKit 教程时仍然遇到问题:http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/MultipleWindows.html
.h文件如下:
#import <Cocoa/Cocoa.h>
#import <WebKit/WebKit.h>
@interface MyDocument : NSDocument
{
IBOutlet id webView;
IBOutlet id textField;
}
- (IBAction)connectURL:(id)sender //Provides me with the error 'Expected ";" before "{" token'
{
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[sender stringValue]]]];
}
@end
您能看出其中有什么问题吗?为什么它给我带来了问题?
- 谢谢你!
是的!你的头文件中已经有了你的实现。将其移至您的 .m 文件:
- (IBAction)connectURL:(id)sender {
[[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[sender stringValue]]]];
}
并将其替换为方法声明:
- (IBAction)connectURL:(id)sender;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)