自Xcode 7以来的Xcode控制台警告 [英] Xcode console warnings since Xcode 7
问题描述
如果我在xcode 7中启动我的应用(使用Swift 2的iOS 9),则会在开始时收到以下警告:
if I start my app (ios 9 with Swift 2) in xcode 7, I get this warnings at beginning:
10月9日10:45:11 AppName [2866]:CGContextSaveGState:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.10月9日10:45:11 AppName [2866]:CGContextTranslateCTM:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.10月9日10:45:11 AppName [2866]:CGContextRestoreGState:无效的上下文0x0.如果要查看回溯,请设置CG_CONTEXT_SHOW_BACKTRACE环境变量.
Oct 9 10:45:11 AppName[2866] : CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. Oct 9 10:45:11 AppName[2866] : CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable. Oct 9 10:45:11 AppName[2866] : CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
如何解决此警告?
推荐答案
似乎您正在设置视图的拐角半径(使用图层).
It seems like that you are setting the corner radius(working with layers) of a view.
解决方案1:
通过菜单设置环境变量:产品"->方案"->编辑方案".在运行"项中,找到参数"选项卡,您将在选项卡中看到环境变量",添加 CG_CONTEXT_SHOW_BACKTRACE
并将其值设置为YES.
Set environmental variable via menu: Product-> Scheme->Edit Scheme. In "Run" item, locate "Arguments" tab, you'll see "Environmental Variables" in the tab, Add CG_CONTEXT_SHOW_BACKTRACE
and set its value to YES.
解决方案2:-如果上述解决方案不适合您,请从Info.plist中删除UIViewControllerBasedStatusBarAppearance.
Solution 2:- If above solutions does not work for you, then remove the UIViewControllerBasedStatusBarAppearance from Info.plist.
这篇关于自Xcode 7以来的Xcode控制台警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!