Iphone 如何从webview打开应用程序内的邮件?
这是我的密码Iphone 如何从webview打开应用程序内的邮件?,iphone,objective-c,email,ios6,Iphone,Objective C,Email,Ios6,这是我的密码 if ([ [ requestURL scheme ] isEqualToString: @"mailto" ]) { MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init]; [composer setMailComposeDelegate:self]; if ([MFMailComposeViewController
if ([ [ requestURL scheme ] isEqualToString: @"mailto" ])
{
MFMailComposeViewController *composer = [[MFMailComposeViewController alloc] init];
[composer setMailComposeDelegate:self];
if ([MFMailComposeViewController canSendMail]) {
NSString *strEmail = [NSString stringWithFormat:@"%@",requestURL];
NSString *subString = [[strEmail componentsSeparatedByString:@":"] lastObject];
[composer setToRecipients:[NSArray arrayWithObjects:subString, nil]];
[composer setSubject:@"Kreativ-Q"];
[composer setMessageBody:@"" isHTML:YES];
[composer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentModalViewController:composer animated:YES];
[composer release];
}
}
但当我在webview中单击链接时,它正在邮箱中打开。当我从那里发送或取消邮件并返回到我的应用程序时,邮件仍然在那里。他们给我看了两次。我只是想,它只会在我的应用程序中打开
提前感谢。可能会帮助您:
如果没有,请在.h文件中设置此委托
<MFMailComposeViewControllerDelegate>
requestURL方案的NSLog是什么?检查条件**如果([MFMailComposeViewController canSendMail])**为什么不创建composer对象?如果邮件未配置,我建议显示邮件。如果我正确理解您的问题,您要求在应用程序中打开/阅读电子邮件。MFMailComposeViewController用于撰写和发送新电子邮件,不会读取收到的电子邮件。@Rajneesh071它是“mailto”。它正在成功地进入,但邮件打开了两次。也在邮箱里。。当时应用程序进入后台,当我返回应用程序时,mailcontroller被打开。可能是这种情况调用了两次。。只需在这段代码中设置断点