iOS6.0下奇怪的_UIRecordArgumentOfInvocationAtIndex异常

来源:互联网 发布:山下智久石原里美 知乎 编辑:程序博客网 时间:2024/05/21 03:17

遇到的问题:

以下两种定制化UIBarButtonItem的代码在iOS7下没有问题:

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{NSForegroundColorAttributeName :[UIColor darkGrayColor]} forState:UIControlStateNormal];

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{@“UITextAttributeTextColor”:[UIColor darkGrayColor]} forState:UIControlStateNormal];


但是在iOS下打开一些系统自带的ViewController(例如预览pdf的QLPreviewController)的情况下遇到_UIRecordArgumentOfInvocationAtIndex异常。参照StackOverflow中类似情况的帖子,原来这应该是iOS SDK的一个Bug.以下简单的改动就可以帮你解决问题,也许这种小插曲也是编程乐趣的一部分。 微笑

解决方法:

使用以下方式后问题就解决了:

[[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTitleTextAttributes:@{UITextAttributeTextColor:[UIColor darkGrayColor]} forState:UIControlStateNormal];

参照网址:

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

0 0