Reputation: 2360
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
}
Upvotes: 5
Views: 2803
Reputation: 53341
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
}
Don't check the canSendMail
and the device will show the no accounts alert when you try to send the message
Upvotes: 3