title: How can I set CG_CONTEXT_SHOW_BACKTRACE environmental variable?
body: <p>I have three buttons in my view. After setting the cornerRadus in the viewDidLoad() : <code>button.layer.cornerRadius = 20</code> I get the following error message in the log:</p>
  
  <pre><code> &lt;Error&gt;: CGContextSaveGState: invalid context 0x0. 
  If you want to see the backtrace, please set 
  CG_CONTEXT_SHOW_BACKTRACE environmental variable.
  </code></pre>
  
  <p>Questions: </p>
  
  <ul>
  <li><strike>How can I set CG_CONTEXT_SHOW_BACKTRACE environmental variable?</strike></li>
  <li>Or how can I fix this warning?</li>
  </ul>
  
  <p>Okay I've the backtrace now from the message. It doesn't make any sense to me. Some help please...</p>
  
  <pre><code>Aug  7 14:27:00  &lt;Error&gt;: CGContextSaveGState: invalid context 0x0. Backtrace:
        &lt;-[UIStatusBarItemView updateContentsAndWidth]+33&gt;
         &lt;-[UIStatusBarItemView initWithItem:data:actions:style:]+477&gt;
          &lt;+[UIStatusBarItemView createViewForItem:withData:actions:foregroundStyle:]+134&gt;
           &lt;-[UIStatusBarLayoutManager _createViewForItem:withData:actions:]+163&gt;
            &lt;-[UIStatusBarLayoutManager _prepareEnabledItemType:withEnabledItems:withData:actions:itemAppearing:itemDisappearing:]+36
             &lt;-[UIStatusBarLayoutManager prepareEnabledItems:withData:actions:]+92&gt;
              &lt;-[UIStatusBarForegroundView _setStatusBarData:actions:animated:]+797&gt;
               &lt;-[UIStatusBarForegroundView setStatusBarData:actions:animated:]+332&gt;
                &lt;__51-[UIStatusBar _prepareToSetStyle:animation:forced:]_block_invoke+360&gt;
                 &lt;+[UIView(Animation) performWithoutAnimation:]+65&gt;
                  &lt;-[UIStatusBar _prepareToSetStyle:animation:forced:]+866&gt;
                   &lt;-[UIStatusBar _requestStyleAttributes:animationParameters:forced:]+391&gt;
                    &lt;-[UIStatusBar requestStyle:animationParameters:forced:]+437&gt;
                     &lt;-[UIStatusBar requestStyle:animated:forced:]+90&gt;
                      &lt;-[UIStatusBar _evaluateServerRegistration]+250&gt;
                       &lt;__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke+590&gt;
                        &lt;-[UIView(Hierarchy) _postMovedFromSuperview:]+544&gt;
                         &lt;-[UIView(Internal) _addSubview:positioned:relativeTo:]+1967&gt;
                          &lt;-[UIStatusBarWindow setStatusBar:]+288&gt;
                           &lt;-[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:]+340&gt;
                            &lt;-[UIApplication _runWithMainScene:transitionContext:completion:]+950&gt;
                             &lt;-[UIApplication workspaceDidEndTransaction:]+188&gt;
                              &lt;-[FBSSerialQueue _performNext]+192&gt;
                               &lt;-[FBSSerialQueue _performNextFromRunLoopSource]+45&gt;
                                &lt;__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__+17&gt;
                                 &lt;__CFRunLoopDoSources0+556&gt;
                                  &lt;__CFRunLoopRun+867&gt;
                                   &lt;CFRunLoopRunSpecific+488&gt;
                                    &lt;-[UIApplication _run]+402&gt;
                                     &lt;UIApplicationMain+171&gt;
                                      &lt;main+117&gt;
  
  
  
  Aug  7 14:27:00  &lt;Error&gt;: CGContextTranslateCTM: invalid context 0x0. Backtrace:
        &lt;-[UIStatusBarItemView updateContentsAndWidth]+33&gt;
         &lt;-[UIStatusBarItemView initWithItem:data:actions:style:]+477&gt;
          &lt;+[UIStatusBarItemView createViewForItem:withData:actions:foregroundStyle:]+134&gt;
           &lt;-[UIStatusBarLayoutManager _createViewForItem:withData:actions:]+163&gt;
            &lt;-[UIStatusBarLayoutManager _prepareEnabledItemType:withEnabledItems:withData:actions:itemAppearing:itemDisappearing:]+36
             &lt;-[UIStatusBarLayoutManager prepareEnabledItems:withData:actions:]+92&gt;
              &lt;-[UIStatusBarForegroundView _setStatusBarData:actions:animated:]+797&gt;
               &lt;-[UIStatusBarForegroundView setStatusBarData:actions:animated:]+332&gt;
                &lt;__51-[UIStatusBar _prepareToSetStyle:animation:forced:]_block_invoke+360&gt;
                 &lt;+[UIView(Animation) performWithoutAnimation:]+65&gt;
                  &lt;-[UIStatusBar _prepareToSetStyle:animation:forced:]+866&gt;
                   &lt;-[UIStatusBar _requestStyleAttributes:animationParameters:forced:]+391&gt;
                    &lt;-[UIStatusBar requestStyle:animationParameters:forced:]+437&gt;
                     &lt;-[UIStatusBar requestStyle:animated:forced:]+90&gt;
                      &lt;-[UIStatusBar _evaluateServerRegistration]+250&gt;
                       &lt;__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke+590&gt;
                        &lt;-[UIView(Hierarchy) _postMovedFromSuperview:]+544&gt;
                         &lt;-[UIView(Internal) _addSubview:positioned:relativeTo:]+1967&gt;
                          &lt;-[UIStatusBarWindow setStatusBar:]+288&gt;
                           &lt;-[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:]+340&gt;
                            &lt;-[UIApplication _runWithMainScene:transitionContext:completion:]+950&gt;
                             &lt;-[UIApplication workspaceDidEndTransaction:]+188&gt;
                              &lt;-[FBSSerialQueue _performNext]+192&gt;
                               &lt;-[FBSSerialQueue _performNextFromRunLoopSource]+45&gt;
                                &lt;__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__+17&gt;
                                 &lt;__CFRunLoopDoSources0+556&gt;
                                  &lt;__CFRunLoopRun+867&gt;
                                   &lt;CFRunLoopRunSpecific+488&gt;
                                    &lt;-[UIApplication _run]+402&gt;
                                     &lt;UIApplicationMain+171&gt;
                                      &lt;main+117&gt;
  
  
  
  
  Aug  7 14:27:00 &lt;Error&gt;: CGContextRestoreGState: invalid context 0x0. Backtrace:
        &lt;-[UIStatusBarItemView updateContentsAndWidth]+33&gt;
         &lt;-[UIStatusBarItemView initWithItem:data:actions:style:]+477&gt;
          &lt;+[UIStatusBarItemView createViewForItem:withData:actions:foregroundStyle:]+134&gt;
           &lt;-[UIStatusBarLayoutManager _createViewForItem:withData:actions:]+163&gt;
            &lt;-[UIStatusBarLayoutManager _prepareEnabledItemType:withEnabledItems:withData:actions:itemAppearing:itemDisappearing:]+36
             &lt;-[UIStatusBarLayoutManager prepareEnabledItems:withData:actions:]+92&gt;
              &lt;-[UIStatusBarForegroundView _setStatusBarData:actions:animated:]+797&gt;
               &lt;-[UIStatusBarForegroundView setStatusBarData:actions:animated:]+332&gt;
                &lt;__51-[UIStatusBar _prepareToSetStyle:animation:forced:]_block_invoke+360&gt;
                 &lt;+[UIView(Animation) performWithoutAnimation:]+65&gt;
                  &lt;-[UIStatusBar _prepareToSetStyle:animation:forced:]+866&gt;
                   &lt;-[UIStatusBar _requestStyleAttributes:animationParameters:forced:]+391&gt;
                    &lt;-[UIStatusBar requestStyle:animationParameters:forced:]+437&gt;
                     &lt;-[UIStatusBar requestStyle:animated:forced:]+90&gt;
                      &lt;-[UIStatusBar _evaluateServerRegistration]+250&gt;
                       &lt;__45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke+590&gt;
                        &lt;-[UIView(Hierarchy) _postMovedFromSuperview:]+544&gt;
                         &lt;-[UIView(Internal) _addSubview:positioned:relativeTo:]+1967&gt;
                          &lt;-[UIStatusBarWindow setStatusBar:]+288&gt;
                           &lt;-[UIApplication _createStatusBarWithRequestedStyle:orientation:hidden:]+340&gt;
                            &lt;-[UIApplication _runWithMainScene:transitionContext:completion:]+950&gt;
                             &lt;-[UIApplication workspaceDidEndTransaction:]+188&gt;
                              &lt;-[FBSSerialQueue _performNext]+192&gt;
                               &lt;-[FBSSerialQueue _performNextFromRunLoopSource]+45&gt;
                                &lt;__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__+17&gt;
                                 &lt;__CFRunLoopDoSources0+556&gt;
                                  &lt;__CFRunLoopRun+867&gt;
                                   &lt;CFRunLoopRunSpecific+488&gt;
                                    &lt;-[UIApplication _run]+402&gt;
                                     &lt;UIApplicationMain+171&gt;
                                      &lt;main+117&gt;
  </code></pre>