当我 alloc
/init
MFMailComposerViewController
时,它没有被分配,并且对象是 nil
。呈现 mailViewController
时应用程序崩溃。这是我的代码:
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject"hotos"];
NSString *body = [NSString stringWithFormat"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">"
"<html>"
"<head>"
"<meta http-equiv=\"Content-Type\" content=\"text/html;charset=UTF-8\">"
"</head>"
"<body>"
"%@"
"</body>"
"</html>",[NSString stringWithFormat"icture from %@",APP_NAME]];
[picker setMessageBody:body isHTML:YES];
NSData* data = UIImagePNGRepresentation(self.sharedImage);
[picker addAttachmentData:data mimeType"image/png" fileName:APP_NAME];
[self presentViewController:picker animated:YES completion:nil];
第 1 步:我认为首先您需要从设备的设置中添加帐户。如果您尚未从设置中添加帐户,那么您将遇到此类问题。
第 2 步:属性化和综合您的 MFMailComposeView ControllerObject
关于ios - MFMailComposeViewController 对象未在 iPad 中分配,但在模拟器中工作正常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26009365/
欢迎光临 OStack程序员社区-中国程序员成长平台 (https://ostack.cn/) | Powered by Discuz! X3.4 |