gpt4 book ai didi

iphone - 显示系统警报 "No Mail Accounts"

转载 作者:可可西里 更新时间:2023-11-01 04:44:16 25 4
gpt4 key购买 nike

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

我看到一个同类应用程序以本地化语言发出“无邮件帐户”警报。

我想要同样的警报,它也应该被本地化。

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

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

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

最佳答案

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

            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,当您尝试发送邮件时,设备将显示无帐户提示

关于iphone - 显示系统警报 "No Mail Accounts",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17925414/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com