预期“;”之前“{”令牌? [英] Expected ";" before "{" token?

查看:108
本文介绍了预期“;”之前“{”令牌?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我仍然在使用我从苹果网站尝试的WebKit教程时遇到问题:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/DisplayWebContent/Tasks/MultipleWindows.html

I am still having trouble with the WebKit tutorial that I am trying from Apple's website: 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文件:

Yes! you've got your implementation in your header file. Move this to your .m file:

- (IBAction)connectURL:(id)sender {
    [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[sender stringValue]]]];
}

并将其替换为方法声明:

And replace it with the method declaration:

- (IBAction)connectURL:(id)sender;

这篇关于预期“;”之前“{”令牌?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆