I am using MFMailcomposer for sending mail from my application in IPhone.It is all working fine,but when i port it to iPhone 5 and ios6 sometime
_serviceViewControllerReady:error: Error Domain=_UIViewServiceInterfaceErrorDomain Code=1 "The operation couldn’t be completed. (_UIViewServiceInterfaceErrorDomain error 1.
but if i run again there is no problem it was working fine.
I am presenting the mail composer like this `
action
{
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
// We must always check whether the current device is configured for sending emails
if ([mailClass canSendMail])
{
[self displayComposerSheet];
}
else
{
[self launchMailAppOnDevice];
}
}
else
{
[self launchMailAppOnDevice];
}
}
void)displayComposerSheet
{
AppDelegate *appdelegate=[[UIApplication sharedApplication] delegate];
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"report"];
// Set up recipients
NSArray *toRecipients=[NSArray arrayWithObject:@""];
NSArray *ccRecipients =[[NSArray alloc]init];//= [NSArray arrayWithObjects:@"", @"", nil];
NSArray *bccRecipients=[[NSArray alloc]init];// = [NSArray arrayWithObject:@""];
[picker setToRecipients:toRecipients];
[picker setCcRecipients:ccRecipients];
[picker setBccRecipients:bccRecipients];
[picker setMessageBody:@"Please send me now." isHTML:YES];
[appdelegate.navigationController presentModalViewController:picker animated:YES];
[appdelegate.navigationController.navigationBar setHidden:NO];
[picker release];
}
`
I had the same issue, and it seems to be a bug that is related to specific UIAppearance
customizations. It goes away entirely when I remove my customization of UISearchBar
background images.
You should use : As presentModalViewController
is deprecated in iOS 6.
[appdelegate.navigationController presentViewController:picker animated:YES completion:nil];
instead of
[appdelegate.navigationController presentModalViewController:picker animated:YES];
I also faced this same problem but at last solved it.
Close xcode and restart system, it will work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With