Problems:
The following two types of custom UIBarButtonItem code are correct under iOS7:
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName :[UIColor darkGrayColor]} forState:UIControlStateNormal];
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{@“UITextAttributeTextColor”:[UIColor darkGrayColor]} forState:UIControlStateNormal];
However, when you open some built-in ViewController in iOS (for example, preview QLPreviewController in pdf), The _ UIRecordArgumentOfInvocationAtIndex exception occurs. Refer to the post in similar cases in StackOverflow. It turns out to be a Bug in iOS SDK. The following simple changes can help you solve the problem. Maybe this episode is part of programming fun.
Solution:After using the following methods, the problem is solved:
[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{UITextAttributeTextColor:[UIColor darkGrayColor]} forState:UIControlStateNormal];
Reference: http://stackoverflow.com/questions/14125378/uiappearence-support-for-ios-6-unexpected-results
Http://stackoverflow.com/questions/19863972/mfmailcomposeviewcontroller-crashes-because-of-global-appearance-properties-on-i
Http://stackoverflow.com/questions/22489828/adbannerview-crashes-app-when-it-is-clicked
Http://stackoverflow.com/questions/12567708/monotouch-ios-6-crash-when-using-mfmailcomposeviewcontroller