xcode 7 错误:CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG

来源:互联网 发布:2017年新出的网络剧 编辑:程序博客网 时间:2024/04/30 12:18
Oct 12 16:01:45 yingyong[1639] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.Oct 12 16:01:45  yingyong[1639] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.Oct 12 16:01:45  yingyong[1639] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.2015-10-12 16:01:46.075 yingyong[1639:228828] CUICatalog: Invalid asset name supplied: (null)2015-10-12 16:01:46.075 yingyong[1639:228828] CUICatalog: Invalid asset name supplied: (null)

出错原因:
设置app的状态栏样式的使用使用了旧的方式,在info.plist里面设置了View controller-based status bar appearance为NO,默认为YES,一般式iOS6的时候使用这种方式,iOS7,8也兼容,但是到了iOS9就报了警告。

解决办法:
(1)删除 原先的设置代码

//设置状态栏的白色    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

(2)修改plist方式将View controller-based status bar appearance设置为YES,然后使用新的方式来实现状态栏的样式。
(3)在你的 自定义导航控制器里面 写上如下方法:

//设置状态栏的(亮色)白色-(UIStatusBarStyle)preferredStatusBarStyle{    return UIStatusBarStyleLightContent;}记住要clean 或者删除应用程序 重新运行
0 0
原创粉丝点击