CGContextSaveGState:无效上下文0x0仅在设备上错误 [英] CGContextSaveGState: invalid context 0x0 Error only on device

查看:58
本文介绍了CGContextSaveGState:无效上下文0x0仅在设备上错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新:我在Swift 2.0中使用XCode 7 Beta

当我尝试在iPhone上运行我的应用程序时,我得到了这3个错误:

When I try to run my app on an iPhone I get these 3 errors:

<Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
<Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

当我启用CG_CONTEXT_SHOW_BACKTRACE变量时,我得到以下信息:

When I enable to CG_CONTEXT_SHOW_BACKTRACE variable I get this:

Backtrace:
      <<redacted>+40>
       <<redacted>+432>
        <<redacted>+144>
         <<redacted>+172>
          <<redacted>+332>
           <<redacted>+112>
            <<redacted>+820>
             <<redacted>+688>
              <<redacted>+356>
               <<redacted>+80>
                <<redacted>+808>
                 <<redacted>+344>
                  <<redacted>+420>
                   <<redacted>+104>
                    <<redacted>+284>
                     <<redacted>+556>
                      <<redacted>+504>
                       <<redacted>+1792>
                        <<redacted>+220>
                         <<redacted>+284>
                          <<redacted>+920>
                           <<redacted>+168>
                            <<redacted>+184>
                             <<redacted>+56>
                              <<redacted>+24>
                               <<redacted>+540>
                                <<redacted>+724>
                                 <CFRunLoopRunSpecific+384>
                                  <<redacted>+460>
                                   <UIApplicationMain+204>
                                    <main+164>

我不确定如何解释,我的代码中没有使用任何CoreGraphics内容,其他类似问题的答案对我不起作用。我知道很难在没有代码的情况下进行调试,但是我无法弄清楚与此相关的代码,因此,如果有人有想法,我可以发布更多代码。

I'm not sure how to interpret this, I am not using any CoreGraphics content in my code, and the other similar questions had answers that did not work for me. I understand it can be difficult to help debug without code, but I can't figure out what code is related to this, so if anyone has an idea I can post more code.

推荐答案

根据我的实验,这似乎是由于在 Info.plist 中定义了 UIViewControllerBasedStatusBarAppearance

From my experimentation, this seems to be due to defining UIViewControllerBasedStatusBarAppearance in Info.plist.

它发生在iOS 9(测试版和GM)上,而不是8.4。

It happens on iOS 9 (beta & GM) but not on 8.4.

这篇关于CGContextSaveGState:无效上下文0x0仅在设备上错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆