【发布时间】:2013-09-04 07:39:48
【问题描述】:
以下行在 iPad 上崩溃。我正在使用带有 6.0 的 Xcode 4.6.3 (4H1503) 作为目标操作系统平台。它以前工作得很好!
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
[self presentViewController:mailViewController animated:YES completion:nil];
}
以下情况除外:
2013-09-04 02:30:47.489 MyProject[38633:5b0b] * 断言失败 NSDictionary *_UIRecordArgumentOfInvocationAtIndex(NSInvocation *, NSUInteger, BOOL)(), /SourceCache/UIKit_Sim/UIKit-2380.17/UIAppearance.m:1118
2013-09-04 02:31:00.816 MyProject[38633:5b0b] * 终止应用程序到期 未捕获的异常“NSInternalInconsistencyException”,原因: '未知键,“{size = 13.000000, traits = 标题文本属性字典中的 00000000}"
编辑:由于以下几行,它崩溃了。猜猜为什么?没想到MFMailComposeViewController 和UITabBarItem 有任何关系……
NSDictionary *textAttributesDict = @{ [UIColor whiteColor] : UITextAttributeTextColor,
[UIFont systemFontOfSize:13.0f] : UITextAttributeFont};
[[UITabBarItem appearance] setTitleTextAttributes:textAttributesDict forState:UIControlStateSelected];
[[UITabBarItem appearance] setTitleTextAttributes:textAttributesDict forState:UIControlStateNormal]`;
【问题讨论】:
-
您是否检查过该设备可以发送邮件?您的撰写视图有委托吗?
-
异常提到了 UIAppearance。您是否自定义了撰写视图可能使用的任何控件的外观? (例如导航栏)?如果有,怎么做?
-
是检查设备是否可以发送电子邮件。无论如何也不会改变导航栏的外观。
-
+1 David Rönnqvist:已修复。更新了我的问题,谢谢指点!
-
你的键和对象应该是相反的。像这样
@{key: object, ...}
标签: objective-c uikit