2014-02-13 7 views
0

내 코드에 "Parse Issue - Expected Statement"오류가 표시되며이를 수정하기 위해 무엇을 변경해야하는지 모릅니다.iOS 앱의 "Parse Issue - Expected Statement"

-(IBAction)email { 
    MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init]; 
    [composer setMailComposeDelegate:self]; 
    if ([MFMailComposeViewController canSendMail]) { 
     [composer setToRecipients:[NSArray arrayWithObjects:@"[email protected]", nil]]; 
     [composer setSubject:@"subject here"]; 
     [composer setMessageBody:@"message here"isHTML:NO]; 
     [composer setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; 
     [self presentViewController:composer animated:YES completion:nil]; 
    } 
    else { 

    } 
} 

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { 
    if (error) { 
     UIAlertView *alert = [[UIAlertView alloc] 
           initWithTitle:@"error" 
           message:[NSString stringWithFormat:@"error %@", [error description]] 
           delegate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil, nil]; 
     [alert show]; 
     [self dismissViewControllerAnimated:YES completion:nil]; 
    } 
    else { 
     [self dismissViewControllerAnimated:YES completion:nil]; 
    } 
} 
+1

올바른 들여 쓰기를 사용하면 더 명확합니다. ;-) 이메일 메서드에서'else'를 제거하십시오. –

답변

1

에 대해 보여줍니다. 중괄호가없는 else 문이 있습니다. 그냥 제거하고 다시 실행하십시오.

-(IBAction)email { 
    MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init]; 
    [composer setMailComposeDelegate:self]; 
    if ([MFMailComposeViewController canSendMail]) { 
     [composer setToRecipients:[NSArray arrayWithObjects:@"[email protected]", nil]]; 
     [composer setSubject:@"subject here"]; 
     [composer setMessageBody:@"message here"isHTML:NO]; 
     [composer setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; 
     [self presentViewController:composer animated:YES completion:nil]; 
    } 
} 
+0

굉장! 완벽하게 일했습니다. 고마워요! – user3230481

1

문제는 당신 -(IBAction)email 방법에있다 :

-(IBAction)email { 
    MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init]; 
    [composer setMailComposeDelegate:self]; 
    if ([MFMailComposeViewController canSendMail]) { 
     [composer setToRecipients:[NSArray arrayWithObjects:@"[email protected]", nil]]; 
     [composer setSubject:@"subject here"]; 
     [composer setMessageBody:@"message here"isHTML:NO]; 
     [composer setModalTransitionStyle:UIModalTransitionStyleCoverVertical]; 
     [self presentViewController:composer animated:YES completion:nil]; 
    } 
    else 
     } 

예상 문 오류가이 중괄호이 코드를 사용해보십시오^

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error { 
    if (error) { 
     UIAlertView *alert = [[UIAlertView alloc] 
           initWithTitle:@"error" 
           message:[NSString stringWithFormat:@"error %@", [error description]] 
           delegate:nil cancelButtonTitle:@"dismiss" otherButtonTitles:nil, nil]; 
     [alert show]; 
     [self dismissViewControllerAnimated:YES completion:nil]; 
    } 
    else { 
     [self dismissViewControllerAnimated:YES completion:nil]; 
    }