gpt4 book ai didi

ios - 如何调用电子邮件应用程序?

转载 作者:行者123 更新时间:2023-11-29 13:14:20 26 4
gpt4 key购买 nike

在ios系统中如何通过代码调用邮件应用?我想查看邮件界面,而不是发送邮件界面。

谢谢。

最佳答案

你可以利用这个:

- (void)launchMailAppOnDevice
{
NSMutableString *subject = [NSMutableString string];
[subject appendString:@"Your Subject"];

NSMutableString *mailbody = [NSMutableString string];
[mailbody appendString:@"Blah Blah Blah"];
[mailbody appendString:@"Blah Blah Blah "];

NSString *recipients = [NSString stringWithFormat:@"mailto:test@test.com?&subject=%@!",subject];

NSString *body = [NSString stringWithFormat:@"&body=%@!",mailbody];;

NSString *emailString = [NSString stringWithFormat:@"%@%@", recipients, body];

emailString = [emailString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:email]];
}

如果你想检查邮件应用程序是否存在并且你想打开它。

if ([[UIApplication sharedApplication] canOpenURL:[ NSURL URLWithString:@"mailto:"]]) 
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:"]];

关于ios - 如何调用电子邮件应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16205804/

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