Assertion failure in -[UICGColor encodeWithCoder:]

今天在使用UISearchBar的时候,当真机调试时当点击进入UISearchBar的编辑模式时,程序闪退,错误代码如下:

2014-11-14 11:51:55.552 EcoDuo[3306:1350850] <UIView: 0x17018b120; frame = (0 0; 290 44); clipsToBounds = YES; autoresize = W+H; layer = <CALayer: 0x1702337a0>>

2014-11-14 11:51:57.527 EcoDuo[3306:1350850] *** Assertion failure in -[UICGColor encodeWithCoder:], /SourceCache/UIKit/UIKit-3318.16.14/UIColor.m:1448

2014-11-14 11:51:57.532 EcoDuo[3306:1350850] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only RGBA or White color spaces are supported in this situation.'

*** First throw call stack:

(0x1830c5e48 0x1937c00e4 0x1830c5d08 0x183f49554 0x187c1d770 0x183f11430 0x183f18a4c 0x187e3c340 0x187e39d44 0x182fb1c60 0x182fb1b40 0x187e39a18 0x187f99130 0x187ed4710 0x187ddcb14 0x100360e30 0x100360df0 0x10036575c 0x18307d6a0 0x18307b748 0x182fa91f4 0x18c13f5a4 0x1878da784 0x100093010 0x193e2ea08)

libc++abi.dylib: terminating with uncaught exception of type NSException

后来发现和IOS8中使用的三方输入法有关系,换百度和搜狗都不行,但是用原生的不会出现这个问题,但是该问题在QQ等使用UISearchBar的应用中都不会闪退,因此开始查找原因,最后发现是由于在AppDelegate.m使用

[[UINavigationBar appearance] setBarTintColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"back.png"]]];

这一句导致的,删除这一句,统一的导航条颜色设置放在BaseController中解决。在此记录一下,方便遇到和我一样问题的童鞋解决问题。


你可能感兴趣的:(Assertion failure in -[UICGColor encodeWithCoder:])