显示系统警报“没有邮件帐户"; [英] Show System Alert "No Mail Accounts"

查看:54
本文介绍了显示系统警报“没有邮件帐户";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Currently I am using [MFMailComposeViewController canSendMail] to check if there exists some Account in Device. If Not I wish to show some Alert.

我看到了一个同类型的应用程序,该应用程序以本地化语言发出没有邮件帐户"警报.

I saw an app of same kind which gives the alert "No Mail Accounts" in Localized Language.

我想要相同的警报,也应将其本地化.

I want the same Alert which should also be localized.

是某些系统警报还是我必须使用所有本地化字符串创建一个自定义?

Is it some system Alert Or Will I have to create a custom with all localization strings?

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

Here is the exact implementation I am using

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

推荐答案

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

It's a system message, so you don't have to localize it, it will be displayed in the correct language if your project contains that language

            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
            }

请勿选中 canSendMail ,当您尝试发送邮件时,设备将显示无帐户"警报

Don't check the canSendMail and the device will show the no accounts alert when you try to send the message

这篇关于显示系统警报“没有邮件帐户";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆