Objective c 当我试图打开邮件生成器时,需要3秒或更长的时间才能打开该生成器
这是我的mailcompose发送邮件的代码。当我按下Email按钮时,mailcomposer需要3秒或更长时间才能弹出Objective c 当我试图打开邮件生成器时,需要3秒或更长的时间才能打开该生成器,objective-c,mfmailcomposeviewcontroller,Objective C,Mfmailcomposeviewcontroller,这是我的mailcompose发送邮件的代码。当我按下Email按钮时,mailcomposer需要3秒或更长时间才能弹出 -(void)emailButtonAction { MFMailComposeViewController *controller = nil; controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate =self ; if
-(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;
}
谁能告诉我如何解决这个问题
感谢大家,,
Monish.哪个iOS版本和设备?设备是iphone 3g和iOS 4.0Hmm。。你在上面运行过Instruments时间分析器吗?是的,我运行过Instruments。你在问有关活动监视的问题吗?@Deepak:如何运行时间分析器?它的用途是什么?