我正在开发一个应用程序,要求是在UIAlertView的按钮上打开电子邮件编辑器.
从UITextView复制邮件的邮件正文中的邮件.我正在使用以下代码片段:
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 0)
{
// opening message composer
}
else
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Test mail"];
[picker setMessageBody:messageBody.text isHTML:YES];
[self presentViewController:picker animated:YES completion:NULL];
}
}
// mail compose delegate
- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error
{
[self dismissViewControllerAnimated:YES completion:NULL];
}
Run Code Online (Sandbox Code Playgroud)
但问题是我得到错误,说应用程序试图在目标上呈现一个零模态视图控制器.我们如何在ios 7中打开默认邮件编辑器?
我知道如何使用MFMessageComposeViewController撰写邮件并转发短信,我想在后台发送短信而不显示邮件编辑器视图.所以,如果我点击按钮,短信会在没有提示给用户的情况下发送到后台.
有第三方API,如Twilio,nexmo和tropo,但我没有得到如何实现这些API.
还有其他方法可以在后台发送短信吗?