How to configure MFMailComposeViewController so that I can make the "in" field not editable?

I use MFMailComposeViewController to send feedback in my application. It is working fine. But the problem here is that the user can edit / delete the address "on". I want to make it indispensable. Maybe the user can add some email addresses in the To field.

But he / she should not delete the feedback address (here it is " support@xxxx.com ").

Here is my code ...

MFMailComposeViewController *composeWindow = [[MFMailComposeViewController alloc] init]; composeWindow.mailComposeDelegate = self; NSString *str = @"Subject of the feedback"; [composeWindow setSubject:[str stringByAppendingString:[[UIDevice currentDevice]systemVersion]]]; NSArray *toRecipients = [NSArray arrayWithObject: @" support@xxxx.com "]; [composeWindow setToRecipients:toRecipients]; [self presentModalViewController:composeWindow animated:YES]; [composeWindow release]; 

Thanks at Advance

Rajkanth

+4
source share
3 answers

You cannot configure MFMailComposeViewController to avoid editing. Apple forbids this, and the reason is quite simple: it is the user, not you, who must decide exactly what to send, to whom, etc. The same applies to the user interface controller, which allows you to send SMS (text) messages. And, of course, Apple does not allow you to send email or SMS without explicit user interaction. The user must confirm and send an email or SMS. The verification process includes the ability to discard the message or change any individual property as desired, including the to recipients.

+6
source

All other answers are correct. You cannot change the interface of MFMailComposeViewController. But you have other possibilities .; -)

The Three20 SDK also includes Mail Composer. Give it a try. I think this should be so volatile that the "to" field is no longer editable.

I hope my answer will be useful to you.

Sandro Meyer

EDIT

The Three20 SDK was discontinued some time ago. Therefore, you should no longer use it for new projects. We recommend using NimbusKit instead . This is also recommended by the SDK 320 team. Unfortunately, it does not include MailComposeViewController.

+6
source

From the Apple documentation :

Important. The mail composition interface is not configurable and cannot be changed by your application. In addition, after the presentation of the interface, your application cannot make further changes to the contents of the email. The user can still edit the content using the interface, but programmatic changes are ignored. Thus, before presenting the interface, you must set the values ​​of the content fields.

+3
source

Source: https://habr.com/ru/post/1340418/


All Articles