我在带有MFMailComposeViewController的ios 7应用程序中有一个反馈按钮.用户单击此按钮后,mailcomposer将打开,但状态栏将更改为黑色.有谁知道我该怎么办?
我只有ios7才有这个问题.我为ios7定制了我的应用程序.
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setSubject:@"Feedback"];
// Fill out the email body tex
NSString *emailBody = [NSString stringWithFormat:@"testest"],
[UIDevice currentDevice].model,
[UIDevice currentDevice].systemVersion];
[mailController setMessageBody:emailBody isHTML:NO];
[mailController setToRecipients:[NSArray arrayWithObjects:@"support@test.com",nil]];
dispatch_async(dispatch_get_main_queue(), ^{
[self presentModalViewController:mailController animated:YES];
}
Run Code Online (Sandbox Code Playgroud) 我想在一个UIImage
组合表中插入一个s MFMailComposerViewController
.
请注意我不想附加它们,但我想使用HTML代码将它们放在一个表格中,这将是电子邮件正文的一部分.
我打电话MFMailComposeViewController
给UITableViewController
.问题是当我在"邮件撰写"窗口中选择" 取消"或" 发送"按钮时,从不调用委托方法:
mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult
Run Code Online (Sandbox Code Playgroud)
这是表视图类:
@implementation DetailsTableViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section==0 && indexPath.row==4) {
//SEND MAIL
MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
if ([MFMailComposeViewController canSendMail]) {
[controller setSubject:[NSString stringWithFormat:@"Ref %@",[item objectForKey:@"reference"]]];
[controller setMessageBody:@" " isHTML:NO];
[controller setToRecipients:[NSArray arrayWithObject:[item objectForKey:@"email"]]];
[self presentModalViewController:controller animated:YES];
}
[controller release];
}
}
- (void)mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
// NEVER REACHES THIS PLACE
[self dismissModalViewControllerAnimated:YES];
NSLog (@"mail finished");
}
Run Code Online (Sandbox Code Playgroud)
应用程序不会崩溃.按下"取消"或"发送"按钮后,"构建窗口"将停留在屏幕上并禁用按钮.我可以按Home键退出应用程序.
我可以打开TableView的其他模态视图,但不能打开MailCompose.
我已经设置了一个MFMailComposeViewController,它可以在iPhone上正常工作,但在iPad上崩溃,说:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target...
Run Code Online (Sandbox Code Playgroud)
那么为什么会创建一个零模态视图呢?
MFMailComposeViewController *message = [[MFMailComposeViewController alloc] init];
[message setMessageBody:@"My message here" isHTML:NO];
[message setToRecipients:[NSArray arrayWithObject:@"my@domain.com"]];
[message setSubject:@"Request Info"];
message.mailComposeDelegate = self;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
message.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:message animated:YES];
[message release];
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
如何更改UINavigationBar
in MFMailComposeViewController
in 的标题颜色iOS 12
?
这就是我在做的事情:
import MessageUI
extension MFMailComposeViewController {
open override func viewDidLoad() {
super.viewDidLoad()
navigationBar.isTranslucent = false
navigationBar.isOpaque = false
navigationBar.barTintColor = .white
navigationBar.tintColor = .white
navigationBar.titleTextAttributes = [NSAttributedStringKey.foregroundColor: UIColor.white]
}
}
Run Code Online (Sandbox Code Playgroud)
在iOS 10中工作:
在iOS 11中工作:
在iOS 12中不起作用:
iphone uinavigationbar ios swift mfmailcomposeviewcontroller
我正在开发一个应用程序,要求是在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中打开默认邮件编辑器?
我有一个棘手的问题.在我的一个应用程序中,有超过150,000次下载...我遇到了一个很少发生的问题,我似乎无法弄明白.
问题如下:在用户可以通过电子邮件共享列表的视图中,我使用打开邮件窗口MFMailComposeViewController
.但是,在少数情况下,应用程序似乎使用邮件编辑器出现问题.用户按下共享按钮,邮件窗口向上滑动,等待约1-2秒,然后再次关闭.邮件窗口中没有内容,尽管我确实向其发送数据.我自己无法在任何设备或模拟器中重新创建问题,但是有一位同事.我在他的手机上使用XCode运行应用程序并在日志中获得以下内容:
2013-03-01 14:43:39.604 appname[318:907] <MFMailComposeRemoteViewController: 0x1ebfb100> timed out waiting for fence barrier from com.apple.MailCompositionService
2013-03-01 14:43:39.631 appname[318:907] viewServiceDidTerminateWithError: Error Domain=XPCObjectsErrorDomain Code=2 "The operation couldn’t be completed. (XPCObjectsErrorDomain error 2.)"
Run Code Online (Sandbox Code Playgroud)
我搜索了错误"从com.apple.MailCompositionService等待栅栏屏障超时",但无法找到任何帮助.
有没有人有这方面的经验?我该如何解决?
我打开视图的代码:
-(void)displayComposerSheetWithBodyString:(NSString *)aBody
{
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc]init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Lista"];
NSString *emailBody = aBody;
[picker setMessageBody:emailBody isHTML:NO];
[self.navigationController presentModalViewController:picker animated:YES];
}
else
{
[[[UIAlertView alloc]initWithTitle:NSLocalizedString(@"Din enhet är inte redo att skicka e-post. Kontrollera dina inställningar", nil)
message:nil
delegate:self …
Run Code Online (Sandbox Code Playgroud) 是否有可能以某种方式锁定字段,MFMailComposeViewController
以便用户无法更改正文,收件人等?我需要用户发送的电子邮件去特定帐户和身体符合某些标准,所以如果用户大幅度编辑格式,一切都可能会出现可怕的错误.当时正文从用户的数据填充输入到上一个视图中的文本字段和日期选择器.
基本上我认为将字段锁定而不是显示警告或者说"请不要编辑消息"这样更专业,所以如果字段无法锁定,这不是一个大问题,但任何帮助我将不胜感激.
情况是MFMailComposeViewController将被呈现.我看到它已经完成了一半,但后来被解雇了.
这是错误:
_serviceViewControllerReady:error:Error Domain = _UIViewServiceInterfaceErrorDomain Code = 3"无法完成操作.(_UIViewServiceInterfaceErrorDomain error 3.)"
这是我提供MFMailComposeViewController的源代码:
-(void) MailExecute {
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setSubject:NSLocalizedString(@"Check this new look", @"")];
[mailViewController setMessageBody: @"my new look" isHTML:YES];
[self presentModalViewController:mailViewController animated:YES];
[mailViewController release];
}
else
{
UIAlertView *alertInternal = [[UIAlertView alloc]
initWithTitle: NSLocalizedString(@"Notification", @"")
message: NSLocalizedString(@"You have not configured your e-mail client.", @"")
delegate: nil
cancelButtonTitle:NSLocalizedString(@"OK", @"")
otherButtonTitles:nil];
[alertInternal show];
[alertInternal release];
}
}
Run Code Online (Sandbox Code Playgroud)
奇怪的是,有时会发生,有时则不然.请帮帮我!我花了将近1个工作日来解决这个问题,但没有成功.
我试图找出在电子邮件正文中添加图像的最佳方式,而不是在ios中作为附件.
1)Apple提供了一个功能" addAttachment ",并且doc说,要在内容中添加任何图像,我们应该使用这个功能,但我尝试了这个功能,并发了一封邮件,我在浏览器上查了一下,就收到了一个附件.
2)其次,许多博客都说要使用base64编码,但这也不会起作用,图像会以破坏的形式发送.
所以朋友们,请帮助我找到最好的解决方案来做到这一点.
问候Ranjit
mfmailcomposeviewcontroller ×10
ios ×8
iphone ×3
objective-c ×3
ios7 ×2
attachment ×1
cocoa-touch ×1
email ×1
ios5 ×1
ipad ×1
locking ×1
swift ×1