Chr*_*ris 16 objective-c mfmailcomposer ios6 mfmailcomposeviewcontroller
在iOS 6上,在发送一些电子邮件消息后(通过使用MFMailComposeViewController),电子邮件屏幕打开速度非常慢 - 首次打开时没有填充任何字段(没有主题,没有正文等)几秒钟,并且最终(在发送大约8条消息之后),在电子邮件视图控制器正确显示之前,向用户显示黑屏几秒钟.
在显示每个黑屏之前,日志会吐出以下行:
[MFMailComposeRemoteViewController:....]等待来自com.apple.MailCompositionService的围栏障碍超时
此外,在iOS6上使用MFMailComposeViewController会导致MailCompositionS进程开始占用内存(它在我的iPhone上一直上升到大约260MB).我假设这是MFMailComposeViewController显示问题的原因.
在iOS 5上运行正常.此问题仅发生在iOS 6上.
有没有人找到解决这个问题的方法?
谢谢!
代码是标准的,但无论如何我都会包含它:
-(IBAction)doEmailLog:(id)sender
{
if( [self canSendMail] )
{
// create the compose message view controller
MFMailComposeViewController* mailComposer = [[MFMailComposeViewController alloc] init];
// this class will handle the cancel / send results
mailComposer.mailComposeDelegate = self;
// fill in the header and body
[mailComposer setSubject:@"My Subject"];
[mailComposer setMessageBody:@"My message body" isHTML:NO];
// attach log file
if ([[NSFileManager defaultManager] fileExistsAtPath:filename])
{
NSData *data = [NSData dataWithContentsOfFile:filename];
[mailComposer addAttachmentData:data mimeType:@"text/plain" fileName:filename];
}
// show the view controller
[self presentViewController:mailComposer animated:YES completion:^{LogTrace(@"Presented mail view controller");}];
}
else
{
...
}
}
-(void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
...
// dismiss the compose message view controller
[self dismissViewControllerAnimated:YES completion:^{LogTrace(@"Finished dismissing mail controller");}];
}
Run Code Online (Sandbox Code Playgroud)
在 ios 6 上,邮件编辑器是它自己的应用程序(在您的应用程序内):: http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/
如果你使用 ARC,代码对我来说看起来不错,否则它会泄漏,在 ios6 上可能会导致 x XPC 遥控器
如果一切顺利,我会将其归咎于苹果新的 XPC 处理中的一个错误
| 归档时间: |
|
| 查看次数: |
6608 次 |
| 最近记录: |