0

I am creating a Note kind of application using ARC, where user can share his notes via Email. My problem is when I present a MFMailComposeViewController then app is crashing with the below error :

*** 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'

The code is as follows:

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];
        }

I have implemented the MFMailComposeViewControllerDelegate protocol. Can you please give me any suggestion that where i am doing wrong? Thanks

user2786
  • 656
  • 4
  • 13
  • 35
  • Did you look at [this](http://stackoverflow.com/questions/19863972/mfmailcomposeviewcontroller-crashes-because-of-global-appearance-properties-on-i) post? – Gad Jun 02 '14 at 08:01
  • Can you add some more code related to above things? – iMash Jun 02 '14 at 08:29

1 Answers1

1

you have given 'strNoteText' as MessageBody, check whether it is null or not

Nagendra
  • 357
  • 2
  • 13
  • strNoteText is not null. The error was i have mentioned [[UINavigationBar appearance] setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor whiteColor]; in my code. Thanks – user2786 Jun 03 '14 at 06:49