我已经实现了邮件编辑器。但只要用户在iphone中实现了邮件帐户,它就会打开邮件编写器。我的要求是如果用户没有实现邮件accont,则应该打开邮件设置。
答案 0 :(得分:2)
试试这段代码......
if ([mailClass canSendMail])
{
[self displayComposerSheet];
}
else
{
//open mail set up
[self launchMailAppOnDevice];
}
// Launches the Mail application on the device.
-(void)launchMailAppOnDevice
{
NSString *recipients = @"mailto:first@example.com?cc=second@example.com,third@example.com&subject=Hello from California!";
NSString *body = @"&body=It is raining in sunny California!";
NSString *email = [NSString stringWithFormat:@"%@%@", recipients, body];
email = [email stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}