如何在iPhone上以编程方式显示邮件设置页面? [英] How do I show the mail setup page programmatically on iPhone?
问题描述
如何以编程方式显示邮件设置页面?
在我的应用程序中,我向用户提供了一个反馈选项。在点击反馈按钮时,我检查设备中是否有可用的邮件帐户。这是通过以下检查完成的:
if([MFMailComposeViewController canSendMail])
/ pre>
{
//发送邮件的操作
}
else
{
//通过UIAlertView显示错误消息的操作
}
警报消息将如下所示:
如果用户点击此
UIAlertView
,我想去设置菜单中提供的邮件设置页面。也就是说,我想显示以下页面:
是否可以以编程方式执行此导航?
解决方案当用户点击警报视图确定按钮时,请使用以下代码。
[[UIApplication sharedApplication ] openURL:[NSURL URLWithString:@mailto:test@test.com]];
这将打开本机邮件应用程序主页,允许用户添加新的邮件帐户。 p>
希望这有助于:)
How do I show the mail setup page programmatically?
In my app, I offered a feedback option to the user. While tapping on the feedback button, I check whether is there any mail account available in the device or not. This is done with the following check:
if ([MFMailComposeViewController canSendMail]) { // Actions to send mail } else { //Actions to show an error message by UIAlertView }
The alert message will be like this:
If the user taps on the OK button in this
UIAlertView
, I want to go to the mail setup page available in the settings menu. That is, I want to show the following page:Is it possible to do this navigation programmatically?
解决方案When the user clicks on the alert view 'OK' button, use the below code.
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: @"mailto:test@test.com"]];
This will open the native Mail application home page allowing the user to add a new mail account.
Hopes this helps :)
这篇关于如何在iPhone上以编程方式显示邮件设置页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!