Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: App crash "-[MFMailComposeInternalViewController _notifyCompositionDidFinish]"

according to crashlytic someone crash while using the iPad. The crash error they received is -[MFMailComposeInternalViewController _notifyCompositionDidFinish] I don't know how this could've occurred. Here is the exception Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000c

Here is the raw data

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x30fa4f46 objc_msgSend + 5
1  MessageUI                      0x252e5f01 -[MFMailComposeInternalViewController _notifyCompositionDidFinish] + 464
2  CoreFoundation                 0x23524294 __invoking___ + 68
3  CoreFoundation                 0x23451435 -[NSInvocation invoke] + 300
4  libdispatch.dylib              0x314f87bb _dispatch_call_block_and_release + 10
5  libdispatch.dylib              0x314f87a7 _dispatch_client_callout + 22
6  libdispatch.dylib              0x314fbfa3 _dispatch_main_queue_callback_4CF + 718
7  CoreFoundation                 0x234e59d1   __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
8  CoreFoundation                 0x234e40d1 __CFRunLoopRun + 1512
9  CoreFoundation                 0x23432211 CFRunLoopRunSpecific + 476
10 CoreFoundation                 0x23432023 CFRunLoopRunInMode + 106
11 GraphicsServices               0x2a7c20a9 GSEventRunModal + 136
12 UIKit                          0x26a3e1d1 UIApplicationMain + 1440
13 MyApp                          0x0009e7e7 main (main.m:16)

Not sure how I can diagnose it.

like image 764
Wizard Lizard Avatar asked Oct 19 '22 22:10

Wizard Lizard


1 Answers

This crash happens when MFMailComposeInternalViewController object released and MFMailComposeInternalViewControllerDelegate fired.

Make sure to retain your MFMailComposeInternalViewController object until following delegate fire and then you can safely dismiss the MFMailComposeInternalViewController object.

-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
    switch (result) {
        case MFMailComposeResultCancelled:
            break;
        case MFMailComposeResultSaved:
            break;
        case MFMailComposeResultSent:
            break;
        case MFMailComposeResultFailed:
            break;
        default:
            break;
    }
    [controller dismissViewControllerAnimated:YES completion:nil];
}
like image 144
Charitha Basnayake Avatar answered Oct 22 '22 13:10

Charitha Basnayake