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 Playlist Browser with Objective-C Working With Multiple View Controllers Modifying the UI

Donovan Cotter
Donovan Cotter
9,424 Points

"Yay! You pressed the button" doesn't show up.

Hello, I made sure all of my code matches the video tutorial. When I click the button it goes to the playlist view but instead of it saying "Yay! You pressed the button" or "You haven't pressed the button" it just no longer has any text there. Has anyone else experienced this?

-I even copied and pasted the code from the download to make sure it was correctly typed out and ran it but it still did the same thing.

Thanks

Jhoan Arango
Jhoan Arango
14,575 Points

I’m having the same issue, and it also gives me an error when I use “ as “ and it gives me a fix it option to put it “as!” to force downcast. I am not sure what is going on, or if the new Xcode update had some changes as the Xcode they were using in the video is a previews version.

agusruiz
agusruiz
9,668 Points

Same here, nothing is showing, also I got a warning about the frame of the label regarding run time.

No idea what is wrong, maybe xCode version?

6 Answers

Donovan Cotter
Donovan Cotter
9,424 Points

I ended up fixing it. I realized that in my segue I had the identified as "showPlaylistDetail" and in the code in PlayListMasterViewController.m I did had "ShowPlaylistDetail" with the S capitalized. I made sure they both matched and it worked.

  • (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@"ShowPlaylistDetail"]) {

-I hope this helps in some way.

Jhoan Arango
Jhoan Arango
14,575 Points

Donovan, when using code to post on the forum use 3 backticks and then use the word swift. Then paste the code and close it with another 3 backticks. So that we can read the code better. You can also reference the Markdown Cheatsheet. Which you can find it above the Post comment button.

Now I am going to go back to my project and see if I find something.

Jhoan Arango
Jhoan Arango
14,575 Points

Well, I did have the same problem as you lol. The one thing that I do find different, is that in the video they do not put the word “ as! “. And Xcode forces me to do so. Weird

Kuan Chung Chang
Kuan Chung Chang
5,607 Points

Got the same issue. while I found that my problem is like yours: "wrong name of segue"

agusruiz
agusruiz
9,668 Points

Hahaha same problem, thanks for that! I was going crazy about it!

Nice, I ended up naming the identifier of the segue different then what I was calling in my code. Strange Xcode didn't complain about that and at least warn that there is name of identifier I am requesting at runtime. hmmmm

Robin Gabre
Robin Gabre
2,537 Points

+1

My problem was similar. However, I followed the steps and named the identifier. But when I was writing the code the identifier name wasn't stored so the code did not enter the if statement.

Still it's not working.....Nothing shows up in DetailViewController

Jhoan Arango
Jhoan Arango
14,575 Points

Hello Andrea :

Would you care to show your code ? maybe we can help you further.

Along with the non-existent text I noticed a few things:

  • When I set a breakpoint in PlaylistMasterViewController it was ignored.
  • I also saw "Unknown class ViewController in Interface Builder file."
  • "Button" also stopped changing to Press Me!

(.... much poking, prodding, swearing and Googling.... )

Either it wasn't there in the video or I missed it. After you renamed the ViewController files, you needed to update the Custom Class name of the ViewController (the first one). You do this by selecting PlaylistMasterViewController in the Class field using the pull-down on the Identity Inspector Tab in the Utilities pane.