【发布时间】:2011-03-13 20:54:27
【问题描述】:
我在我的 switch 语句中遇到了一个错误,其中包含一些多行 Objective-c 代码:
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error
{
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
break;
case MFMailComposeResultFailed:
// NSLog(@"Mail Failed");
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(@"Error", @"Error")
message:[error localizedDescription]
delegate:nil
cancelButtonTitle:NSLocalizedString(@"OK", @"OK")
otherButtonTitles:nil];
[alert show];
[alert release];
break;
default:
break;
}
}
如果我取消注释带有NSLog 的行,它可以正常工作。是什么导致了这个错误?有没有办法使用这种格式?
【问题讨论】:
标签: objective-c formatting switch-statement