我想在我的iPhone应用程序中发送电子邮件。我听说iOS SDK没有电子邮件API。我不想使用下面的代码,因为它会退出我的应用程序:
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]];
那么,我该如何从我的应用程序发送电子邮件?
presentModalViewController:animated:
和dismissModalViewControllerAnimated:
已被标记为弃用 - 应该使用基于块的替代方法presentViewController:animated:completion:
和dismissViewControllerAnimated:completion:
。请确保使用新的方法。 - user577537@interface viewController : UIViewController <MFMailComposeViewControllerDelegate>
- Nazir[self presentModalViewController:controller animated:YES];
替换为[self presentViewController:controller animated:YES completion:nil];
并将[self dismissModalViewControllerAnimated:YES];
替换为[self dismissViewControllerAnimated:YES completion:nil];
。 - Nazir