它适用于iPhone,此问题仅发生在iPad(iOS7)上。太奇怪了。
我收到了这个错误日志:
_serviceViewControllerReady:error:Error Domain = _UIViewServiceInterfaceErrorDomain Code = 0“无法完成操作。(_UIViewServiceInterfaceErrorDomain error 0。)”
我做了一些搜索,一些答案说它可能与定制的UINavigationBar外观有关。
就我而言,我正在使用导航控制器并更改其颜色和状态栏颜色
在info.plist中:set View controller-based status bar appearance
为NO
然后在appDelegate
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
我尝试评论该行,问题仍然存在。所以我认为这不是问题所在。
这是我的发送电子邮件代码和代理
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil) {
if ([mailClass canSendMail]) {
MFMailComposeViewController *mailPicker = [[MFMailComposeViewController alloc] init];
mailPicker.mailComposeDelegate = self;
NSString *emailbody = @"";
[mailPicker setSubject: subject];
NSArray *toRecipients = [NSArray arrayWithObject: recipient];
[mailPicker setToRecipients: toRecipients];
[mailPicker setMessageBody:emailbody isHTML:NO];
[self presentViewController:mailPicker animated:YES completion:nil];
}
}
- (void)mailComposeController:(MFMailComposeViewController *)controller
didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error {
[self dismissViewControllerAnimated:YES completion:nil];
}