当我提出一个问题时,我遇到了以下崩溃MFMailComposeViewController:
2013-11-08 11:04:05.963 <redacted>[7108:1603] *** Assertion failure in NSDictionary *_UIRecordArgumentOfInvocationAtIndex(NSInvocation *, NSUInteger, BOOL)(), /SourceCache/UIKit/UIKit-2380.17/UIAppearance.m:1118
2013-11-08 11:04:06.032 <redacted>[7108:1603] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Unknown key, "NSColor" in title text attributes dictionary'
Run Code Online (Sandbox Code Playgroud)
我在AppDelegate的application:didFinishLaunchingWithOptions:方法中将其跟踪到以下外观设置:
[[UINavigationBar appearance] setTitleTextAttributes:
@{NSForegroundColorAttributeName : [UIColor whiteColor]}];
Run Code Online (Sandbox Code Playgroud)
注释掉该行就可以了,但是会破坏应用程序的其余部分,所以我尝试将titleTextAttributes专门设置为空字典MFMailComposeViewController:
尝试#1
[[UINavigationBar appearanceWhenContainedIn:
NSClassFromString(@"MFMailComposeViewController"), nil]
setTitleTextAttributes:@{ }];
Run Code Online (Sandbox Code Playgroud)
这导致同样的崩溃.和
[[UINavigationBar appearanceWhenContainedIn:
NSClassFromString(@"MFMailComposeViewController"), nil]
setTitleTextAttributes:nil];
Run Code Online (Sandbox Code Playgroud)
也导致同样的崩溃.
尝试#2
我注意到这MFMailComposeViewController是一个UINavigationController,所以也许全局外观设置本地化到UINavigationController 内的UIViewControllers .我整理了一些代码来确定MFMailComposeViewController中的视图控制器:
for (UIViewController *viewController in mailViewController.viewControllers) {
NSLog(@"%@", NSStringFromClass([viewController …Run Code Online (Sandbox Code Playgroud)