2

Why is this crashing only on on a device with 8.2? on other versions works just fine and even on simulator with 8.2 works fine...

var mailPicer = MFMailComposeViewController()
    mailPicer.mailComposeDelegate = self
    mailPicer.setCcRecipients(["bla@dad.com"])
    mailPicer.setEditing(true, animated: true)
    mailPicer.setSubject("I have something to tell you")
    mailPicer.setMessageBody("bla bbla`", isHTML: true)
    self.presentViewController(mailPicer, animated: true, completion: nil) 

I am not getting any log for the crash as well...

Any thoughts?

Alex Cio
  • 6,014
  • 5
  • 44
  • 74
Waylli
  • 43
  • 1
  • 5
  • Access the crash logs on your device from the Xcode Devices window and see what the crash dump tells you. – Léo Natan Mar 31 '15 at 11:08
  • well I must be slow today :) this is the log Exception Type: EXC_CRASH (SIGABRT) Exception Codes: 0x0000000000000000, 0x0000000000000000 Triggered by Thread: 0 Last Exception Backtrace: 0 CoreFoundation 0x1823b6530 __exceptionPreprocess + 132 1 libobjc.A.dylib 0x1933400e4 objc_exception_throw + 60 2 UIKit 0x186edb0cc -[UIViewController _presentViewController:withAnimationController:completion:] + 3376 – Waylli Mar 31 '15 at 11:18
  • 1
    As I said before slow today.... Sorry for the post I didn`t check if MFMailComposeViewController.canSendMail() ...... – Waylli Mar 31 '15 at 11:33

2 Answers2

1

Check if MFMailComposeViewController.canSendMail()

Undo
  • 25,519
  • 37
  • 106
  • 129
Waylli
  • 43
  • 1
  • 5
0

add this before executing the rest of your app:

if(!MFMailComposeViewController.canSendMail()) {
    // show user a message f.e.
    return
}
Alex Cio
  • 6,014
  • 5
  • 44
  • 74