【发布时间】:2012-01-26 01:36:14
【问题描述】:
有人可以帮我编写以下代码吗?对于在 iOS 中发送电子邮件,下面的代码是一个好代码还是我应该使用 MFMailComposeViewController 而不是这个?:
NSString *url = [NSString stringWithString: @"mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!"];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];NSString *url = [NSString stringWithString: @"mailto:foo@example.com?cc=bar@example.com&subject=Greetings%20from%20Cupertino!&body=Wish%20you%20were%20here!"];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString: url]];
它是发送邮件的可靠代码吗?
【问题讨论】:
-
您不需要在文字字符串上使用
stringWithString:。它已经是一个字符串。 (事实上,拨打stringWithString:的理由很少。)
标签: ios cocoa-touch cocoa mfmailcomposeviewcontroller