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 Build a Simple iPhone App with Swift Views and View Controllers View Controllers and IBAction

println not working

Hello, im trying to add println("You pressed me") but im keep getting an error saying println has to be renamed to print. Can anyone please help me with this? Thank you

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

And they're correct. The println() was renamed to print() in Swift 2.0. So try replacing your code with:

 print("You pressed me")

Hope this helps! :sparkles:

Thank you:)

Hi Samuel,

Yup - println has been deprecated. Everything is print now. Some of the videos in the swift 2.2 course are slightly dated.

Cheers, Marc

Thank you:)

after putting print instead of println I pressed Show Another Fun Fact and i get this

You pressed me! 2016-07-12 21:24:25.372 FunFacts[1405:102776] -[FunFacts.ViewController showFunFact:]: unrecognized selector sent to instance 0x7f99448a8dc0 2016-07-12 21:24:25.375 FunFacts[1405:102776] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FunFacts.ViewController showFunFact:]: unrecognized selector sent to instance 0x7f99448a8dc0' *** First throw call stack: ( 0 CoreFoundation 0x000000010aa95d85 exceptionPreprocess + 165 1 libobjc.A.dylib 0x000000010c839deb objc_exception_throw + 48 2 CoreFoundation 0x000000010aa9ed3d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205 3 CoreFoundation 0x000000010a9e4cfa ___forwarding_ + 970 4 CoreFoundation 0x000000010a9e48a8 CF_forwarding_prep_0 + 120 5 UIKit 0x000000010b2bfa8d -[UIApplication sendAction:to:from:forEvent:] + 92 6 UIKit 0x000000010b432e67 -[UIControl sendAction:to:forEvent:] + 67 7 UIKit 0x000000010b433143 -[UIControl _sendActionsForEvents:withEvent:] + 327 8 UIKit 0x000000010b432263 -[UIControl touchesEnded:withEvent:] + 601 9 UIKit 0x000000010b33299f -[UIWindow _sendTouchesForEvent:] + 835 10 UIKit 0x000000010b3336d4 -[UIWindow sendEvent:] + 865 11 UIKit 0x000000010b2dedc6 -[UIApplication sendEvent:] + 263 12 UIKit 0x000000010b2b8553 _UIApplicationHandleEventQueue + 6660 13 CoreFoundation 0x000000010a9bb301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ + 17 14 CoreFoundation 0x000000010a9b122c __CFRunLoopDoSources0 + 556 15 CoreFoundation 0x000000010a9b06e3 __CFRunLoopRun + 867 16 CoreFoundation 0x000000010a9b00f8 CFRunLoopRunSpecific + 488 17 GraphicsServices 0x000000010f12bad2 GSEventRunModal + 161 18 UIKit 0x000000010b2bdf09 UIApplicationMain + 171 19 FunFacts 0x000000010a8b2612 main + 114 20 libdyld.dylib 0x000000010d2fd92d start + 1 21 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

Also i cant press it more than once