预期标识符或 '(' - xCode [英] expected identifier or '(' - xCode

查看:53
本文介绍了预期标识符或 '(' - xCode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名学生,正在为我的学校学习和开发应用.我刚刚开始,一切正常.但是,我收到错误预期标识符或‘(’".我花了几天时间阅读帖子和谷歌搜索,但我发现没有找到适合我的解决方案.

I am a student who is learning and working on an App for my school. I have just started and am doing okay. However, I am recieveing the error "Expected identifier or '(' ". I have spent a few days now reading posts and googleing, and no solution I have found is working for me.

我正在尝试在我的应用程序的第二个选项卡上制作一个圆形按钮以链接到学校的网站.

I am trying to make a Round Rect Button on the second tab of my application to link to the school's website.

这是.h:

#import <UIKit/UIKit.h>

@interface SecondViewController : UIViewController  {

}


- (IBAction)Website:(id)sender;



 @end

这是我的 .m 并注释了错误:

and here is my .m with error commented:

#import "SecondViewController.h"

@interface SecondViewController ()

@end

@implementation SecondViewController 

-(IBAction)Website {
[[UIApplication sharedApplication ] openURL:[NSURL URLWithString:@"http://www.google.com"]];

}


{      **// Error is on this line[23]**
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}


- (IBAction)Website;


- (IBAction)Website:(id)sender; {
}
@end

我该如何解决这个小家伙?非常感谢!此外,.h 文件是由 xCode 形成的,通过简单地控制从按钮拖动到 .h 并创建一个动作.这可能是原因吗?

How can I fix this little guy? Thank you very much! Also, the .h file was formed by xCode, by simply control dragging from button, to .h and creating an action. Could this be the cause?

推荐答案

我想你不小心删除了这一行:

I think you have accidentally deleted this line:

- (void)viewDidLoad

在这一行之上

{      **// Error is on this line[23]**

但为了简单起见,您可以删除它:

but for simplicity you could delete this:

{      **// Error is on this line[23]**
     [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
 }

因为您没有将 viewDidLoad 用于任何事情

as you are not using viewDidLoad for anything

这篇关于预期标识符或 '(' - xCode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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