1

Following lines are crashing on iPad. I am using Xcode 4.6.3 (4H1503) with 6.0 as target OS platform. It used to work just fine!

if ([MFMailComposeViewController canSendMail]) {
    MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
    [self presentViewController:mailViewController animated:YES completion:nil];
}

With following exceptions:

2013-09-04 02:30:47.489 MyProject[38633:5b0b] * Assertion failure in NSDictionary *_UIRecordArgumentOfInvocationAtIndex(NSInvocation *, NSUInteger, BOOL)(), /SourceCache/UIKit_Sim/UIKit-2380.17/UIAppearance.m:1118

2013-09-04 02:31:00.816 MyProject[38633:5b0b] * Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unknown key, "{size = 13.000000, traits = 00000000}" in title text attributes dictionary'

EDIT: Its crashing due to the following lines. Any guess why? Never thought MFMailComposeViewController could have any relation to UITabBarItem ...

NSDictionary *textAttributesDict = @{ [UIColor whiteColor] : UITextAttributeTextColor,
                                          [UIFont systemFontOfSize:13.0f] : UITextAttributeFont};

[[UITabBarItem appearance] setTitleTextAttributes:textAttributesDict forState:UIControlStateSelected];
[[UITabBarItem appearance] setTitleTextAttributes:textAttributesDict forState:UIControlStateNormal]`;
Yas Tabasam
  • 10,517
  • 9
  • 48
  • 53

1 Answers1

1

The NSDictionary had key/value reversed. It is supposed to have key:value instead of value:key

NSDictionary *textAttributesDict = @{ [UIColor whiteColor] : UITextAttributeTextColor,
                                          [UIFont systemFontOfSize:13.0f] : UITextAttributeFont};

Changing above to the following worked. Thanks Desdenova for a pointer.

NSDictionary *textAttributesDict = @{UITextAttributeTextColor : [UIColor whiteColor],
                                          UITextAttributeFont : [UIFont systemFontOfSize:13.0f]};
Yas Tabasam
  • 10,517
  • 9
  • 48
  • 53