-4

こんにちは、私は 4 つのボタンを使用しようとしていますが、それぞれのボタンを押すと異なるアラートが表示されます。問題が発生しています。3 つのボタンがあり、「Rate My App」ボタンを追加することにしましたが、機能しません。助けてください。(ちなみにエラーはExexted Expression です)(Org.=Organization (アプリ内固定), Email- アプリ内リアルメール,

#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

コードにタイプミスがあります:;最後の 2 つのelse if条件の後に余分があります:

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