1

次の行は iPad でクラッシュします。ターゲット OS プラットフォームとして 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' が原因でアプリを終了しています。

編集:次の行が原因でクラッシュします。なぜだと思いますか?関係があるとは思わMFMailComposeViewControllerなかったUITabBarItem...

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

[[UITabBarItem appearance] setTitleTextAttributes:textAttributesDict forState:UIControlStateSelected];
[[UITabBarItem appearance] setTitleTextAttributes:textAttributesDict forState:UIControlStateNormal]`;
4

1 に答える 1

1

NSDictionaryキーと値が逆になっていました。value:keyの代わりにkey:valueを持つことになっています

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

上記を次のように変更するとうまくいきました。ポインタをくれたDesdenovaに感謝します。

NSDictionary *textAttributesDict = @{UITextAttributeTextColor : [UIColor whiteColor],
                                          UITextAttributeFont : [UIFont systemFontOfSize:13.0f]};
于 2013-09-16T17:16:32.140 に答える