我正在使用Note
创建ARC
种应用程序,用户可以通过电子邮件分享他的笔记。我的问题是当我提出MFMailComposeViewController
然后应用程序崩溃时出现以下错误:
*** Assertion failure in NSDictionary *_UIRecordArgumentOfInvocationAtIndex(NSInvocation *, NSUInteger, BOOL)(), /SourceCache/UIKit/UIKit-2380.17/UIAppearance.m:1118
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unknown key, "NSColor" in title text attributes dictionary'
代码如下:
if ([MFMailComposeViewController canSendMail])
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
NSString *strSubject = [NSString stringWithFormat:@"A Note from %@", [prefs stringForKey:@"strAppTitle"]];
[picker setSubject:strSubject];
NSString *emailBody = strNoteText;
[picker setMessageBody:emailBody isHTML:NO];
[self presentViewController:picker animated:YES completion:nil];
}
我已经实施了MFMailComposeViewControllerDelegate
协议。你能否告诉我任何我做错的地方?感谢
答案 0 :(得分:1)
你已经将'strNoteText'作为MessageBody,检查它是否为空