iphone - 邮件功能 iphone App 崩溃

标签 iphone email crash

在我的应用程序中使用电子邮件功能时,如果我们没有在任何电子邮件地址登录,应用程序就会崩溃。

无论如何要为此添加异常(exception),即用户在没有应用程序崩溃的情况下获得 Alertview?

最佳答案

您可以做的是检查设备是否可以发送邮件,如下所示。

 MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
 if ([MFMailComposeViewController canSendMail] == NO) {
       //your alertview telling error 
    return;
}
   else
 {
    //your code for sending mail
  }

快乐编码!@!!!

关于iphone - 邮件功能 iphone App 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16916171/

相关文章:

ios - 我可以通过拉伸(stretch)UILabel的角来改变IOS模拟器中UILabel运行时的框架吗?

javascript - heroku 配置变量为 Nodemailer 设置电子邮件

iPhone:5秒视频拍摄

ios - Xcode 8 消息模板应用程序 : Error on iOS Simulator

bash - 如何在 bash 中插入返回插入符和新行?

unit-testing - 在没有 Controller 的情况下测试电子邮件发送

php - 阻止我的脚本使用这么多内存?

android - AlertDialog.show() 使我的应用程序崩溃

c++ - 链表的 Delete_At 函数使程序崩溃

iphone - ADBanner查看内容