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 iOS Foundations Storyboards Delegation

Problem with addNewPun

I am getting an error msg "No none class message for selector 'punWithTitle:rating" when I run the code. My code seems to match Anit's so I dont know the problem. Here is the section and the error shows up on the first line of the method. I suspect I am missing something elsewhere. Thx

(void) addNewPun {

self.pun = [Pun punWithTitle:self.textView.text rating:self.ratingSlider.value];

[self.delegate addPunToList:self.pun];
[self.navigationController dismissModalViewControllerAnimated:YES];

}

9 Answers

Stone Preston
Stone Preston
42,016 Points

do you have that method declared and defined in your Pun.h and Pun.m files?

No, but neither does Anit. I dont know what this custom method does, so I dont know how to implement it. In fact, at the 9:36 mark in the Saving Data Part 1, he gets the same error in the LIstViewController and just deletes the code and sets the array to nil (for some reason). These videos insert & remove code without telling you so often - it is really frustrating.

Stone Preston
Stone Preston
42,016 Points

hmm that looks like a custom convenience constructor, which means it has to be defined in your Pun class. are you sure he doesnt have it?

At 1:18, he shows both Pun.h & m and neither have a declaration/implementation of punWithTitle:rating:

Stone Preston
Stone Preston
42,016 Points

when he called that method does he make any mention of "we havent implemented this method yet but we are going to do that later" or something. Did you watch the whole video?

Not that I recall and I have watched it twice

Stone Preston
Stone Preston
42,016 Points

ok tagging Amit Bijlani maybe he can answer whats going on

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

If you check out the setup video at the 4 minute mark I show you that the basic model is already created as part of the project. This a short course which is primarily focused on storyboards so the convenience constructor is provided for you. You can download the project files and see the implementation.

why is this constructor no longer in Pun.h & m at the 1:18 mark of Saving Data Part 1 ?

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

Since that is a stage on Core Data and Pun is a subclass of NSManagedObject we do things differently.

and where should I start using the provided Pun project file? should I assume we are not using previous Pun project files for every video and download the zip file every time? There is no mention of which file to use in the video; our files from previous videos or the zip on the page.

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

Each video page has project files associated to it so that you can review the code that was added in that video.

And you can no longer implement punWithTitle statically because title & rating have been changed to dynamic. How should I proceed?

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

I'm guessing you are now referring to Core Data. You can create a convenience constructor if you want. As the name state it's mainly meant for convenience and not required.

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

I'd highly recommend following the iOS Development Track which is kind of like a playlist of courses that guides you which course to take next. We are going to be retiring iOS Foundations soon because it is a bit dated.

Thomas Nilsen
Thomas Nilsen
14,957 Points

Will there be a replacement for this once it's taken down? Also, the new IOS course is coming soon (can't wait!), but no date set yet. Do you know when it will be released?

Amit Bijlani
Amit Bijlani
Treehouse Guest Teacher

There won't be an exact replacement but we will be replacing it with some exciting new content. We will be releasing the new course on March 24th. I've updated the roadmap.