我的代碼顯示「Parse Issue - Expected Statement」錯誤,我不知道需要更改或添加哪些內容才能解決問題。iOS中的「解析問題 - 預期聲明」
-(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];
}
有了正確的縮進,它就顯而易見了。 ;-)刪除電子郵件方法中的「else」。 –