Reputation: 2724
I've got a MFMailComposeViewController and I believe it is implemented correctly. However when it is displayed on the screen (through modal) it just opens, hangs for a second, then closes and logs MFMailComposeResultCancelled
any thoughts?
if ([MFMailComposeViewController canSendMail]){
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
if( composer == nil ){
UIAlertView* alert_view = [[UIAlertView alloc] initWithTitle:@"message"
message:@"You will need to setup a mail account on your device before you can send mail!"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert_view show];
return;
}else{
composer.mailComposeDelegate = self;
[composer setSubject:@"I have an issue"];
[composer setMessageBody:@"" isHTML:NO];
[composer setToRecipients:@[@"email"]];
}
[self presentViewController:composer animated:YES completion:^{
;
}];
EDIT found these in the log
Unbalanced calls to begin/end appearance transitions for <UINavigationController: 0xcda5e90>.
The operation couldn’t be completed. (Cocoa error 4097.)
Upvotes: 1
Views: 1185
Reputation: 2724
MFMailComposeResultCancelled is called if you have any changes that occur to the UI when the MFMailComposer is pulled up.
I must be the default iOS Navigation header, though you can change the tint.
Upvotes: 3
Reputation: 934
On your completion if you don't do anything, put nil
, probably this is the problem.
Upvotes: 0