22
votes

I am having this error in debug area, even when my playground file is empty:

Sep 23 11:03:50 MyPlayground[68315] : CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

Sep 23 11:03:50 MyPlayground[68315] : CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

Sep 23 11:03:50 MyPlayground[68315] : CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.

I've seen answers suggesting modifying plist file. However, I am using .playground file, not an ordinary iOS project. There is no plist file inside the .playground. Any sollutions?

I am using Xcode Version 7.0 (7A220).

2
Was that the .playground file created with previous versions of Xcode? - Dániel Nagy
No, I have just created it in Xcode 7. - Fengson
Report the bug to Apple. They already know about it, but it will speed up their processing of the bug. - Eric Aya
Ok, I did. If they reply, I will let you all know. - Fengson
there's an executable interpreter for terminal.just type 'swift' in a single line.I think it's better than playground. - AntiMoron

2 Answers

1
votes

This appears to be unrelated to your Xcode version as it happens to folks using 7.0 - 7.3. However, it does appear to be related to iOS version. This seems to be a 9.0 issue and upgrading your target to 9.1 or higher should fix it.

Apple reportedly knows about this bug and claimed it to be "fixed" as of 10/29/2015.

See here.

-1
votes

Try going to your app-info.plist. Check thre UIViewControllerBasedStatusBarAppearance and delete it. This may help