显示系统警报"无邮件帐户"

Gan*_*ani 5 iphone objective-c ipad ios

目前我[MFMailComposeViewController canSendMail]用来检查设备中是否存在某个帐户.如果不是我希望显示一些警报.

我看到了一个同类型的应用程序,它以本地化语言提供警报"无邮件帐户".

我想要同样的警报,也应该本地化.

它是一些系统警报还是我必须创建一个包含所有本地化字符串的自定义?

这是我正在使用的确切实现

if (![MFMailComposeViewController canSendMail])
   return nil;
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
if(mailViewController)
{
      //Setting Email Stuff
}
Run Code Online (Sandbox Code Playgroud)

jce*_*ile 3

这是一条系统消息,因此您不必对其进行本地化,如果您的项目包含该语言,它将以正确的语言显示

            Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
            if (mailClass != nil)
            {
                MFMailComposeViewController *vc = [[[MFMailComposeViewController alloc] init] autorelease];
                if (vc!=nil) {
                    [vc setSubject:@"Mail subject"];

                    NSMutableString * message = @"mail message";

                    [vc setMessageBody:message isHTML:YES];


                    vc.mailComposeDelegate = self;

                    [self presentModalViewController:vc animated:YES];
                }

            }
            else
            {
                //Device doesn't include mail class, so it can't send mails
            }
Run Code Online (Sandbox Code Playgroud)

不要勾选,canSendMail当您尝试发送消息时,设备将显示无帐户警报