ios – CGContextSaveGState:应用启动时的无效上下文0x0

前端之家收集整理的这篇文章主要介绍了ios – CGContextSaveGState:应用启动时的无效上下文0x0前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我已将CG_CONTEXT_SHOW_BACKTRACE环境变量设置为YES,因为我有以下错误CGContextSaveGState:无效上下文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>

在发布时发生错误,电池视图似乎有问题.这个错误是否响了你的任何钟声?

FWW我的应用程序大多是用Swift 2.0编写的,在iOS9上使用Xcode 7b6.

@H_502_11@解决方法
我遇到同样的问题,其原因是,我正在为不同的屏幕设置不同的状态栏样式.因此,我需要在plist中添加“查看基于控制器的状态栏外观”键.如果我删除此键,警告消失.

猜你在找的iOS相关文章