Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Kapthehat

macrumors member
Original poster
Jul 1, 2013
51
0
Hello,

I am having a problem with the following piece of code (I am a newbie and just experimenting - so it is nothing complicated). I get an "expected identifier error" on each of the lines in red below. Can somebody help me please ? thanks

regards

Kaps

Code:
//
//  BIDViewController.m
//  Calctest
//
//  Created by Kapil Kapur on 02/09/2013.
//  Copyright (c) 2013 Apress. All rights reserved.
//

#import "BIDViewController.h"

@interface BIDViewController ()

@end

@implementation BIDViewController

- (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.
}


-(IBAction)buttonOnePressed
{
  [COLOR="red"][B][I]  UIAlertView *alert1 = [[UIAlertView] alloc   initWithTitle:@"Calculator test"[/I][/B][/COLOR]
                                                      message:@"You pressed ONE"
                                                     delegate:nil
                                            cancelButtonTitle:@"OK"
                                             otherButtonTitle:nil];
    
    [alert1 show];
}

-(IBAction)buttonTwoPressed
{
    
   [COLOR="red"][I] UIAlertView *alert2 = [[UIAlertView] alloc   initWithTitle:@"Calculator test"[/I][/COLOR]
                                                      message:@"You pressed TWO"
                                                     delegate:nil
                                            cancelButtonTitle:@"OK"
                                             otherButtonTitle:nil];
    
    [alert2 show];

    
    
}

-(IBAction)ButtonThreePressed
{
    [I][COLOR="Red"]UIAlertView *alert3 = [[UIAlertView] alloc   initWithTitle:@"Calculator test"
     [/COLOR][/I]                                                  message:@"You pressed THREE"
                                                      delegate:nil
                                             cancelButtonTitle:@"OK"
                                              otherButtonTitle:nil];
    
    [alert3 show];
    
    
    
    
}
@end
 
Yes, you've got two problems:

- it is [UIAlertView alloc] and not [UIAlertView] alloc
- it is otherButtonTitles and not otherButtonTitle


Code:

Code:
    UIAlertView *alert1 = [[UIAlertView alloc]   initWithTitle:@"Calculator test"
                                                       message:@"You pressed ONE"
                                                      delegate:nil
                                             cancelButtonTitle:@"OK"
                                              otherButtonTitles:nil];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.