Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Xcode not responding to print command

I am taking the swift basic course. I am at 2:45-3:10 in the video where it is talking about printing. When I follow the instructions in the course it does not do anything in Xcode.

This is my code:

//: Playground - noun: a place where people can play

import UIKit

var str : String = "Hello "

let modernProgrammingLanguage: String = "Swift"

var greeting = str + modernProgrammingLanguage

print("To build and iPhone app we need to larn Swift")

This is the error code:

 Oct 5 08:18:00 SWIFT TREEHOUSE[1985] <Error>: CGContextSaveGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Oct 5 08:18:00 SWIFT TREEHOUSE[1985] <Error>: CGContextTranslateCTM: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
Oct 5 08:18:00 SWIFT TREEHOUSE[1985] <Error>: CGContextRestoreGState: invalid context 0x0. If you want to see the backtrace, please set CG_CONTEXT_SHOW_BACKTRACE environmental variable.
To build and iPhone app we need to larn Swift

Can you post you code?

1 Answer

First of all, the errors that you are getting seem to be common, and started showing up for many people with the release of the Xcode 7 GM Seed. The problem does not appear to be fixed in the final release of Xcode 7. Regardless, those errors should not effect your program. The last line of the output that you posted appears to contain the string that you printed.

In my experience with Xcode 7, there doesn't appear to be a way to get the console to show in the assistant editor as it does in the treehouse videos. The only place that things printed in a playground seem to show up is in the debug console at the bottom of the screen. Because of the error messages it can be hard to see the line that you printed, but it looks like it is still there.

Thank for the answer Thomas. Should I continue with the Videos but look to the debug area for proof of the code working? Or do you recommend waiting until Team Treehouse updates the videos. I just want to make sure I do not effect my learning by working with mismatched curriculum and software.