草庐IT

ios - CGContextSaveGState : invalid context 0x0 at App Launch

coder 2023-07-16 原文

我已将 CG_CONTEXT_SHOW_BACKTRACE 环境变量设置为 YES 因为我遇到了以下错误 CGContextSaveGState: invalid context 0x0

以下堆栈跟踪对我帮助不大。

<Error>: CGContextSaveGState: invalid context 0x0. Backtrace:
      <-[UIStatusBarBatteryItemView contentsImage]+773>
       <-[UIStatusBarItemView updateContentsAndWidth]+36>
        <-[UIStatusBarItemView initWithItem:data:actions:style:]+503>
         <+[UIStatusBarItemView createViewForItem:withData:actions:foregroundStyle:]+159>
          <-[UIStatusBarLayoutManager _createViewForItem:withData:actions:]+168>
           <-[UIStatusBarLayoutManager _prepareEnabledItemType:withEnabledItems:withData:actions:itemAppearing:itemDisappearing:]+3
            <-[UIStatusBarLayoutManager prepareEnabledItems:withData:actions:]+108>
             <-[UIStatusBarForegroundView _setStatusBarData:actions:animated:]+951>
              <-[UIStatusBarForegroundView setStatusBarData:actions:animated:]+874>
               <__51-[UIStatusBar _prepareToSetStyle:animation:forced:]_block_invoke+443>
                <+[UIView(Animation) performWithoutAnimation:]+82>
                 <-[UIStatusBar _prepareToSetStyle:animation:forced:]+935>
                  <-[UIStatusBar _requestStyleAttributes:animationParameters:forced:]+404>
                   <-[UIStatusBar requestStyle:animationParameters:forced:]+490>
                    <-[UIStatusBar requestStyle:animated:forced:]+113>
                     <-[UIStatusBar forceUpdateStyleOverrides:]+97>
                      <-[UIStatusBar _evaluateServerRegistration]+294>
                       <-[UIStatusBar didMoveToSuperview]+33>
                        <__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke+683>
                         <-[UIView(Hierarchy) _postMovedFromSuperview:]+484>
                          <-[UIView(Internal) _addSubview:positioned:relativeTo:]+2305>
                           <-[UIView(Hierarchy) addSubview:]+56>
                            <-[UIStatusBarWindow setStatusBar:]+311>
                             <-[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:]+384>
                              <-[UIApplication _runWithMainScene:transitionContext:completion:]+1047>
                               <__84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invo
                                <-[UIApplication workspaceDidEndTransaction:]+163>
                                 <__37-[FBSWorkspace clientEndTransaction:]_block_invoke_2+71>
                                  <__40-[FBSWorkspace _performDelegateCallOut:]_block_invoke+54>
                                   <-[FBSSerialQueue _performNext]+184>
                                    <-[FBSSerialQueue _performNextFromRunLoopSource]+52>
                                     <FBSSerialQueueRunLoopSourceHandler+33>
                                      <__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__+15>
                                       <__CFRunLoopDoSources0+523>
                                        <__CFRunLoopRun+1032>
                                         <CFRunLoopRunSpecific+470>
                                          <CFRunLoopRunInMode+123>
                                           <-[UIApplication _run]+540>
                                            <UIApplicationMain+160>
                                             <main+94>

错误发生在启动时,电池 View 似乎有问题。这个错误是否给您敲响了警钟?

FWW 我的应用程序主要是用 Swift 2.0 编写的,在带有 Xcode 7b6 的 iOS9 上。

最佳答案

我遇到了同样的问题,原因是我在为不同的屏幕设置不同的状态栏样式。因此,我需要在 plist 中添加“View controller-based status bar appearance”键。如果我删除此 key ,警告就会消失。

关于ios - CGContextSaveGState : invalid context 0x0 at App Launch,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32299969/

有关ios - CGContextSaveGState : invalid context 0x0 at App Launch的更多相关文章

  1. ruby - 如何验证 IO.copy_stream 是否成功 - 2

    这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下

  2. Ruby 文件 IO 定界符? - 2

    我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的

  3. 电脑0x0000001A蓝屏错误怎么U盘重装系统教学 - 2

      电脑0x0000001A蓝屏错误怎么U盘重装系统教学分享。有用户电脑开机之后遇到了系统蓝屏的情况。系统蓝屏问题很多时候都是系统bug,只有通过重装系统来进行解决。那么蓝屏问题如何通过U盘重装新系统来解决呢?来看看以下的详细操作方法教学吧。  准备工作:  1、U盘一个(尽量使用8G以上的U盘)。  2、一台正常联网可使用的电脑。  3、ghost或ISO系统镜像文件(Win10系统下载_Win10专业版_windows10正式版下载-系统之家)。  4、在本页面下载U盘启动盘制作工具:系统之家U盘启动工具。  U盘启动盘制作步骤:  注意:制作期间,U盘会被格式化,因此U盘中的重要文件请注

  4. Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting - 2

    1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里

  5. ruby - 为什么不能使用类IO的实例方法noecho? - 2

    print"Enteryourpassword:"pass=STDIN.noecho(&:gets)puts"Yourpasswordis#{pass}!"输出:Enteryourpassword:input.rb:2:in`':undefinedmethod`noecho'for#>(NoMethodError) 最佳答案 一开始require'io/console'后来的Ruby1.9.3 关于ruby-为什么不能使用类IO的实例方法noecho?,我们在StackOverflow上

  6. ruby-on-rails - 如何解决#<Book::ActiveRecord_Relation:0x007fb709a6a8c0> 的未定义方法 `to_key'? - 2

    我遇到了未定义方法`to_key'的问题这是我的books_controller.rbclassBooksController和我的索引页如下。index.html.erb......现在当我要访问索引页面时出现如下错误。undefinedmethod`to_key'for# 最佳答案 index通常返回一个集合。事实上,您的Controller符合要求。但是,您的View试图为其定义一个表单。正如您所发现的,这不会成功。表单适用于实体,而不适用于集合。该错误在您看来以及您希望如何处理index。

  7. ruby-on-rails - Rspec - Controller 测试错误 - Paperclip::AdapterRegistry::NoHandlerError: 找不到 "#<File:0x531beb0>"的处理程序 - 2

    我如下询问了我的Rspec测试。Rspec-RuntimeError:Calledidfornil,whichwouldmistakenlybe4在相同的代码上(“items_controller.rb”的Rspec测试),我试图对“PUTupdate”进行测试。但是我收到错误消息“Paperclip::AdapterRegistry::NoHandlerError:找不到“#”的处理程序。我的Rspec测试如下。老实说,我猜这次失败的原因是“let(:valid_attributes)”上的“photo”=>File.new(Rails.root+'app/assets/images

  8. ruby - 为 IO::popen 拯救 "command not found" - 2

    当我将IO::popen与不存在的命令一起使用时,我在屏幕上打印了一条错误消息:irb>IO.popen"fakefake"#=>#irb>(irb):1:commandnotfound:fakefake有什么方法可以捕获此错误,以便我可以在脚本中进行检查? 最佳答案 是:升级到ruby​​1.9。如果您在1.9中运行它,则会引发Errno::ENOENT,您将能够拯救它。(编辑)这是在1.8中的一种hackish方式:error=IO.pipe$stderr.reopenerror[1]pipe=IO.popen'qwe'#

  9. ruby - IO::EAGAINWaitReadable:资源暂时不可用 - 读取会阻塞 - 2

    当我尝试使用“套接字”库中的方法“read_nonblock”时出现以下错误IO::EAGAINWaitReadable:Resourcetemporarilyunavailable-readwouldblock但是当我通过终端上的IRB尝试时它工作正常如何让它读取缓冲区? 最佳答案 IgetthefollowingerrorwhenItrytousethemethod"read_nonblock"fromthe"socket"library当缓冲区中的数据未准备好时,这是预期的行为。由于异常IO::EAGAINWaitReadab

  10. ruby-on-rails - `method_missing':#<Rails::Application::Configuration:0x00> 的未定义方法 `action_mailer' - 2

    我正在构建一个Rails应用程序并且使用的是Rails4.0.1。我有一个错误,并注意到它在3个月前被称为rails上的一个错误,所以我决定:捆绑更新并获得rails4.0.3这样做之后,测试和服务器都不会启动,并且会抛出错误:gems/railties-4.0.3/lib/rails/railtie/configuration.rb:95:in`method_missing':undefinedmethod`action_mailer'for#(NoMethodError)目前我在config/environments/*中注释掉了action_mailer行,但最好能找到一个真正的

随机推荐