我有一个发送电子邮件的 iPhone 应用程序。如果未设置“收件人:”地址,我将显示警报 (UIAlertView)。目前,我不检查用户是否点击 OK,我只是继续我的快乐方式!:D
在警报上点击确定时出现以下错误:
wait_fences:未能收到回复:10004003
我相信这是因为我没有处理 OK 的点击,并且当应用程序正在执行其他操作时它仍然显示。因此,在对 SO 和 Google 进行了一些研究之后,看来我必须拥有这个:
- (void) Alert: (NSString *) title andData: (NSString *) errorMsg {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: title
message: errorMsg
delegate:nil
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
[alert show];
return;
}
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
NSLog(@"button was pressed");
}
我的问题是我不知道如何为此设置委托。我已经有一个代表:
@interface ReportViewController : UIViewController <UIWebViewDelegate> {
如何设置委托以便处理 OK 按钮的点击,从而消除错误?