-4

嗨,我想有 4 个按钮,每个按钮在按下时都有不同的警报。我遇到了一个问题,我有 3 个按钮,我决定添加一个“评价我的应用程序”按钮,但现在它不起作用,请帮助我。(顺便说一下,错误是Expexted Exspression)(Org.=Organization(在应用程序中固定),电子邮件-应用程序中的真实电子邮件,

#define TAG_Band 1
#define TAG_DEV 2
#define TAG_EDEV 3
#define TAG_RATE 4

@interface Org.ContactInfo () <MFMailComposeViewControllerDelegate>

@end

@implementation Org.ContactInfo:UIViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    self.title = @"Contacts";

    // 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)ContactBand:(id)sender;{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Contact the Band" message:@"Contact the Org. or go to their website!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Visit the Org. Website",@"E-Mail The Org. President", @"E-Mail The Org. Treasurer",  nil];
    alert.tag = TAG_Band;
    [alert show];
}
-(IBAction)ContactDev:(id)sender;{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Contact Me" message:@"Contact Me on Features you would like me to consider! I will do my Best to look at all of the Suggestions!" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Visit My Website",@"E-Mail Me!",  nil];
    alert.tag = TAG_DEV;
    [alert show];
}
-(IBAction)RateMyApp:(id)sender;{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Rate My App" message:@"When Your Reviewing my App, Please remember that this app was at no cost to the Mighty Mustang Band." delegate:self cancelButtonTitle:@"Not Right Now" otherButtonTitles:@"Rate My App!!",  nil];
    alert.tag = TAG_RATE;
    [alert show];


}
-(IBAction)AppInfo:(id)sender;{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Version 1.0" message:@"More Updates Coming Soon. Please Feel Free to E-Mail me on features that you would like me to consider" delegate:self cancelButtonTitle:@"Not Right Now" otherButtonTitles:@"Email-Me",  nil];
    alert.tag = TAG_EDEV;
    [alert show];
}

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (alertView.tag == TAG_Band){


        if (buttonIndex==1){
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://URL.org"]];

        }
        else if (buttonIndex==2){
            //Subject
            NSString *emailTitle = @"";
            //Recipients
            NSString *emailBody=@"Org. President";
            NSArray *toRecipients = [NSArray arrayWithObject:@"Person@Org.org"];

            MFMailComposeViewController *mc=[[MFMailComposeViewController alloc] init];
            mc.mailComposeDelegate = self;
            [mc setSubject:emailTitle];
            [mc setSubject:emailBody];
            [mc setToRecipients:toRecipients];

            [self presentViewController:mc animated:YES completion:NULL];

        }
        else if (buttonIndex==3){
            //Subject
            NSString *emailTitle = @"";
            //Recipients
            NSString *emailBody=@"Org. Treasurer, ";
            NSArray *toRecipients = [NSArray arrayWithObject:@"Person@Org.org"];

            MFMailComposeViewController *mc=[[MFMailComposeViewController alloc] init];
            mc.mailComposeDelegate = self;
            [mc setSubject:emailTitle];
            [mc setSubject:emailBody];
            [mc setToRecipients:toRecipients];

            [self presentViewController:mc animated:YES completion:NULL];

        }
    }
    else if (alertView.tag == TAG_DEV){
        if (buttonIndex==1){
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://stepheniosdeveloper.wordpress.com"]];

        }
        else if (buttonIndex==2){
            NSString *emailTitle = @"";
            //Recipients
            NSString *emailBody=@"";
            NSArray *toRecipients = [NSArray arrayWithObject:@"Email@gmail.com"];

            MFMailComposeViewController *mc=[[MFMailComposeViewController alloc] init];
            mc.mailComposeDelegate = self;
            [mc setSubject:emailTitle];
            [mc setSubject:emailBody];
            [mc setToRecipients:toRecipients];

            [self presentViewController:mc animated:YES completion:NULL];

        }
    }
    else if (alertView.tag == TAG_EDEV);{
        if (buttonIndex==1){
            NSString *emailTitle = @"";
            //Recipients
            NSString *emailBody=@"";
            NSArray *toRecipients = [NSArray arrayWithObject:@"Email@gmail.com"];

            MFMailComposeViewController *mc=[[MFMailComposeViewController alloc] init];
            mc.mailComposeDelegate = self;
            [mc setSubject:emailTitle];
            [mc setSubject:emailBody];
            [mc setToRecipients:toRecipients];

            [self presentViewController:mc animated:YES completion:NULL];

        }
    }
    else if (alertView.tag == TAG_RATE);{         //Expected Expression
        if (buttonIndex==1){
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://itunes.apple.com/us/app/Org/id607257427?ls=1&mt=8"]];
        }
    }
}

它工作在我添加最后一个(TAG_RATE)之前,但现在我不明白为什么它不再工作了。请帮忙。

4

1 回答 1

3

;您的代码中有一个错字:在最后两个else if条件之后您有额外的:

    else if (alertView.tag == TAG_EDEV)/*;*/{  // extra `;`
            //...
    }
    else if (alertView.tag == TAG_RATE)/*;*/{   // extra `;`       //Expected Expression
            // ...
    }
于 2013-02-23T23:11:07.750 回答