Xcode 5预期标识符或'(“

时间:2014-06-09 20:32:10

标签: xcode identifier

//
//  ViewController.m
//  Col10
//
//  Created by  on 6/9/14.
//  Copyright (c) 2014 ___FULLUSERNAME___. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController
@synthesize swagLabel;
-(IBAction)swagTurtle:(id)sender {
swagLabel.text = @"Swag Turtle"; }

{; UIAlertView *message = [[UIAlertView alloc]
                        initWithTitle:@"Hello!"
                        message:@"Please press Ok to finish"
                        delegate:nil
                        cancelButtonTitle:@"Ok"
                        otherButtonTitles:nil];
    [[message show]] }



- (void)viewDidLoad
{
[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.
}

@end

我试着查看我做错了什么,但我需要帮助,我不知道什么是预期的标识符或'('表示。请帮助我,我已经尝试解决这个问题至少一个小时了,现在我刚开始使用Xcode。

1 个答案:

答案 0 :(得分:3)

呃..更好地格式化你的代码,你会看到发生了什么:

 -(IBAction)swagTurtle:(id)sender
 {
    swagLabel.text = @"Swag Turtle";
 }

{;
     UIAlertView *message = [[UIAlertView alloc]
                        initWithTitle:@"Hello!"
                        message:@"Please press Ok to finish"
                        delegate:nil
                        cancelButtonTitle:@"Ok"
                        otherButtonTitles:nil];
    [[message show]]
}