标签: mfmailcomposeviewcontroller

将多个字符串添加到字符串

如何在字符串中添加多个字符串?这是最简单的方法吗?如果我不想在每次向字符串添加内容时创建新的代码行,我想做类似的事情:

    NSString *recipeTitle = [@"<h5>Recipe name: " stringByAppendingFormat:recipe.name, @"</h5>"];
    NSLog(@"%@", recipeTitle);

    // This shows: <h5>Recipe name: myrecipe
    // Where's the </h5> closing that header ? It will only show up with the next line of code

    recipeTitle = [recipeTitle stringByAppendingFormat:@"</h5>"];

    //my problem is that will result in more than 1k lines of programming
Run Code Online (Sandbox Code Playgroud)

我是否必须每次添加附加附加的新行?是否有更快/更有效的方式来做到这一点?

我正在尝试使用我的tableview编写电子邮件正文,这将导致一组庞大的编程行.我是否有人可以给我任何提示或任何比组成一个huuuge字符串更好的东西,以便我可以用包含我的tableview数据的表填充我的电子邮件正文?

任何有助于提高效率的帮助表示赞赏.谢谢 !卡洛斯法里尼.

//在完成它之后我得到了一点:

-(IBAction)sendmail{
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
[composer setMailComposeDelegate:self];
NSString *recipeTitle = @"<h5>Recipe name: ";
recipeTitle = [recipeTitle stringByAppendingFormat:recipe.name];
recipeTitle = [recipeTitle …
Run Code Online (Sandbox Code Playgroud)

xcode uitableview nsstring nsmutablestring mfmailcomposeviewcontroller

5
推荐指数
1
解决办法
8631
查看次数

MFMailComposeViewController:取消不退出到我的应用程序?

我正在尝试使用MFMailComposeViewController发送邮件.当我点击我的应用程序上的按钮时会发生这种情况 当然,当我单击邮件控制器的"取消"按钮时,我想返回到我的应用程序视图,但它不起作用.该怎么办 ?这是我的代码:

MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setSubject:@"Subject"];
[controller setMessageBody:@"<html>Test</html>" isHTML:YES];
[controller setToRecipients:nil];
if(controller) [self presentModalViewController:controller animated:YES];
Run Code Online (Sandbox Code Playgroud)

谢谢你的建议

email objective-c ios mfmailcomposeviewcontroller

5
推荐指数
1
解决办法
3019
查看次数

iOS:应用程序崩溃" - [MFMailComposeInternalViewController _notifyCompositionDidFinish]"

根据崩溃的人在使用iPad时崩溃.他们收到的崩溃错误是-[MFMailComposeInternalViewController _notifyCompositionDidFinish]我不知道这是怎么发生的.这是例外 Crashed: com.apple.main-thread EXC_BAD_ACCESS KERN_INVALID_ADDRESS at 0x0000000c

这是原始数据

Thread : Crashed: com.apple.main-thread
0  libobjc.A.dylib                0x30fa4f46 objc_msgSend + 5
1  MessageUI                      0x252e5f01 -[MFMailComposeInternalViewController _notifyCompositionDidFinish] + 464
2  CoreFoundation                 0x23524294 __invoking___ + 68
3  CoreFoundation                 0x23451435 -[NSInvocation invoke] + 300
4  libdispatch.dylib              0x314f87bb _dispatch_call_block_and_release + 10
5  libdispatch.dylib              0x314f87a7 _dispatch_client_callout + 22
6  libdispatch.dylib              0x314fbfa3 _dispatch_main_queue_callback_4CF + 718
7  CoreFoundation                 0x234e59d1   __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 8
8  CoreFoundation                 0x234e40d1 __CFRunLoopRun + 1512
9  CoreFoundation                 0x23432211 CFRunLoopRunSpecific + 476
10 CoreFoundation                 0x23432023 …
Run Code Online (Sandbox Code Playgroud)

crash objective-c ios unrecognized-selector mfmailcomposeviewcontroller

5
推荐指数
1
解决办法
769
查看次数

iOS 9:UINavigationBar的背景图片不起作用

我有一个全局背景图像(基本上是一些橙色),它为AppDelegate中的所有导航栏设置:

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"order-navbar"] forBarMetrics:UIBarMetricsDefault];
Run Code Online (Sandbox Code Playgroud)

这适用于除一个以外的所有视图:我有一个MFMailComposeViewController,无论我做什么,导航栏背景都保持白灰色:

let mailController = MFMailComposeViewController()
mailController.navigationBar.tintColor = UIColor.whiteColor() // this works
emailController.navigationBar.setBackgroundImage(UIImage(named: "order-navbar") forBarMetrics:UIBarMetrics.Default) // this does not
UINavigationBar.appearance().setBackgroundImage(UIImage(named: "order-navbar") forBarMetrics:UIBarMetrics.Default) // this does neither
Run Code Online (Sandbox Code Playgroud)

但是,有时邮件控制器首先出现橙色条,然后突然再次将其颜色更改为白灰色.

在iOS 8上一切正常.这是iOS 9的错误吗?

background uinavigationbar uiimage mfmailcomposeviewcontroller

5
推荐指数
0
解决办法
638
查看次数

自定义 MFMailComposeViewController

我在自定义MFMailComposeViewControlleriOS 13 上的外观时遇到问题。

我的应用程序在导航栏中使用深色导航栏和白色色调。

    UINavigationBar.appearance().tintColor = BrandManager.globals.textColor
    UINavigationBar.appearance().titleTextAttributes = [NSAttributedString.Key.foregroundColor: UINavigationBar.appearance().tintColor]
    // navBar color for app
    UINavigationBar.appearance().barTintColor = BrandManager.primaryColors.background
    // navBar color for some sharing containers…except MFMessageComposeVC & SLComposeVC (twitter)
    UINavigationBar.appearance().backgroundColor = BrandManager.primaryColors.background
    // navBar color for MFMessageComposeVC & SLComposeVC
    UINavigationBar.appearance().setBackgroundImage(UIImage(color: BrandManager.primaryColors.background), for: .default)

    UIBarButtonItem.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).tintColor = BrandManager.globals.textColor
Run Code Online (Sandbox Code Playgroud)

这适用于 iOS 12 及更早版本。

对于 iOS 13,我得到以下非常奇怪的行为,其中栏按钮项为白色,标题文本为黑色,向上滚动会在正确的导航栏颜色上产生这种奇怪的半透明白色。

显示滚动如何影响视图控制器的图像

我已经尝试了所有我能想到的UIBarButtonItem外观组合,但似乎没有任何效果。我发现的大多数其他解决方案都与 iOS 13 无关。

uinavigationbar uibarbuttonitem uiappearance mfmailcomposeviewcontroller ios13

5
推荐指数
0
解决办法
240
查看次数

MFMailComposeViewController的"无邮件帐户"警报问题 - SDK 3.0 vs SDK 4.0

当我为不同的Base SDK构建它时,我遇到了这段代码的问题:

MFMailComposeViewController *mail = nil;
mail = [[MFMailComposeViewController alloc] init];
NSString *description = @"Some mail string";
if([MFMailComposeViewController canSendMail])
{
    mail.mailComposeDelegate =self;
    [mail setSubject:story.title];
    [mail setMessageBody:[NSString stringWithFormat:(NSString *)kMessageBodyFormat,description,story.webLink] isHTML:NO];
}
[self presentModalViewController:mail animated:YES];
[mail release];
mail=nil;
Run Code Online (Sandbox Code Playgroud)

当我使用Base SDK 3.0构建它时,如果MFMailComposeViewController's初始化返回nil,如果用户没有任何邮件帐户,则会发生这种情况,系统会提供默认的"No mail accounts"警报.

但是当我使用Base SDK 4.0构建它并将其部署到3.0 OS时,如果用户没有任何邮件帐户,系统不会显示相同的警报,而是presentModalViewController崩溃.

MFMailComposeViewController's如果用户在3.0和4.0基本SDK中都没有任何邮件帐户,则初始化返回nil,但在某些地方presentModalViewController智能地在SDK 3.0的情况下发出警报但在3.0上部署的SDK 4.0失败并崩溃.

有没有人遇到过这个问题/任何想法究竟发生了什么.

谢谢,拉吉

iphone iphone-sdk-3.0 mfmailcomposeviewcontroller

4
推荐指数
2
解决办法
5486
查看次数

MFMailComposeViewController的委托不处理CANCEL按钮

可能重复:
点击MFMailComposeViewController的取消按钮时不显示操作表

我根据Apple提供的代码示例在我的应用程序中实现了标准邮件功能.

我正在设置代表如下:

MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
Run Code Online (Sandbox Code Playgroud)

而我正在实施

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
Run Code Online (Sandbox Code Playgroud)

点击发送按钮调用委托,一切正常.但是,点击"取消"按钮不会调用委托,它只会使视图变暗; 应用程序挂在那里.

在这里阅读了类似的主题后,我一直认为视图可能因为某种原因而在屏幕外,这在我看来是无法理解的.请注意,该视图是以编程方式创建的,并未使用xib文件.

有什么想法或想法吗?

iphone delegates objective-c ios mfmailcomposeviewcontroller

4
推荐指数
2
解决办法
9105
查看次数

MFMailComposeViewController的Localizable.strings中的换行符

如何在我的语言文件中添加换行符以供使用MFMailComposeViewController?在\n我doesent工作.使用返回键上的正常klick中断具有相同的结果,没有换行符!


我的档案:

"Body_eMail"= "Hello, here is some text.\n\nLorem ipsum alsu.\n\nAnd some text, more...";
Run Code Online (Sandbox Code Playgroud)

我想要:

你好,

这是一些文字.Lorem ipsum alsu.

还有一些文字,更多......


本作的UILabel工作正常(如@lawicko下文提到),但加入到时MFMailComposeViewController\n字符内置显示,如下图所示:

Hello, here is some text.\n\nLorem ipsum alsu.\n\nAnd some text, more...

什么是正确的方法?

xcode line-breaks localizable.strings ios mfmailcomposeviewcontroller

4
推荐指数
1
解决办法
4394
查看次数

为什么MFMailComposeViewController在应用内电子邮件中不会被忽略?

我正在开发一个iPad应用程序,它创建一个PDF,然后用户通过该应用程序发送电子邮件.我已经能够成功设置电子邮件以附加PDF,但我无法让MFMailComposeViewController解除.我已经阅读了关于这个问题的其他几个问题,并试图模仿他们正在做什么,但邮件编写者仍然不会解雇.我需要在代码中进行哪些更改才能将其解雇?

- (IBAction)submitDailyReportButton:(id)sender {

MFMailComposeViewController *mail = [[MFMailComposeViewController alloc]init];
[mail setMailComposeDelegate:self];

if ([MFMailComposeViewController canSendMail]) {

    NSString *email =@"admin@domain.com";
    NSArray *emailArray = [[NSArray alloc]initWithObjects:email,nil];
    [mail setToRecipients:emailArray];

    [mail setSubject:@"Daily Report"];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

    NSString *newFilePath = [[paths objectAtIndex:0]stringByAppendingPathComponent:@"report.pdf"];

    NSData *pdfData = [NSData dataWithContentsOfFile:newFilePath];
    [mail addAttachmentData:pdfData mimeType:@"application/pdf" fileName:@"report.pdf"];
    NSString *body = @"Please review the attached daily report";
    [mail setMessageBody:body isHTML:NO];
    [mail setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
    [self presentViewController:mail animated:YES completion:nil];

}else{

    NSLog(@"Message cannot be sent");

}
Run Code Online (Sandbox Code Playgroud)

}

ios mfmailcomposeviewcontroller

4
推荐指数
1
解决办法
1967
查看次数

没有安装Mail应用程序的MFMailComposeViewController?

既然可以在iOS 10中删除Apple的"Mail"应用程序等应用程序,那么当开发人员尝试初始化并呈现MFMailComposeViewController并且未在设备上安装和配置默认Mail应用程序时会发生什么?

如果应用程序崩溃,检查此案例的最佳方法是什么?

email ios ios10 mfmailcomposeviewcontroller

4
推荐指数
1
解决办法
2009
查看次数