когда я пытаюсь открыть почтовый композитор, требуется 3 или более секунд, чтобы открыть композитор - PullRequest
0 голосов
/ 26 июня 2011

Вот мой код для почты, составьте для отправки почты. Когда я нажимаю на кнопку электронной почты, почтовому компоновщику требуется 3 или более секунд для всплывающего окна.

-(void)emailButtonAction
{
    MFMailComposeViewController *controller = nil;
    controller = [[MFMailComposeViewController alloc] init];
    controller.mailComposeDelegate =self ;
    if([MFMailComposeViewController canSendMail])
    {
        NSString *emailSubj =@"";
        emailSubj = [emailSubj stringByAppendingString:@"Interesting comic to share with you"];
        [controller setSubject:emailSubj];
        cartoonImage = [self saveCartoon];
        crtImageData = UIImagePNGRepresentation(cartoonImage);
        [controller addAttachmentData:crtImageData
                             mimeType:@"image/png"
                             fileName:@"bluepal_comicbuilder_image.png"];
        [controller setMessageBody:@"I used BluePal's Comic Builder to make this comic and it is very interesting & easy to use. You can also download this application from iTunes and enjoy!" isHTML:YES];
        [self presentModalViewController:controller animated:YES];

    }
    else 
    {
        NSLog(@"no email found");
    }

    [controller release];
    controller=nil;

}


-(void)mailComposeController: (MFMailComposeViewController *)controller

         didFinishWithResult:(MFMailComposeResult)result

                       error:(NSError *)error 
{

    switch (result)
    {
            UIAlertView *alertView1;
        case MFMailComposeResultCancelled:
            break;

        case MFMailComposeResultSaved:
            alertView1=[[UIAlertView alloc]initWithTitle:@"Comic Builder" message:@"Your mail saved successfully" delegate:self cancelButtonTitle:@"Ok!" otherButtonTitles:nil];
            [alertView1 show];
            [alertView1 release];
            break;

        case MFMailComposeResultSent:
            alertView1=[[UIAlertView alloc]initWithTitle:@"Comic Builder" message:@"Your mail sent successfully" delegate:self cancelButtonTitle:@"Ok!" otherButtonTitles:nil];
            [alertView1 show];
            [alertView1 release];
            break;

        case MFMailComposeResultFailed:
            alertView1=[[UIAlertView alloc]initWithTitle:@"Comic Builder" message:@"Unable to send the mail please try again" delegate:self cancelButtonTitle:@"Ok!" otherButtonTitles:nil];
            [alertView1 show];
            [alertView1 release];
            break;

    }
        [controller dismissModalViewControllerAnimated:YES];

}

- (UIImage*)saveCartoon
{
    UIGraphicsBeginImageContext(myView.bounds.size);
    [myFirstView.layer renderInContext:UIGraphicsGetCurrentContext()];
    UIImage *finishedCartoon = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return finishedCartoon;
}

Может кто-нибудь предложить мне, как решить эту проблему.

Спасибо всем, Мониш.

...