Fixing Build Errors and Creating Navigation

I’ve got 99 problems…

Days like this really frustrate me, but I know that they’re a part of learning. Today I spent all of my coding time fixing errors.

Last time when I finished up my tutorial section, I had a build error: “use of undeclared type”. I banged my head against the wall for about 20 minutes trying to figure out how to solve this last time I sat down…but, I know by now that as much as I want to sit there and figure it out…I should get up and do something else, because when I come back and revisit the problem, I almost always easily solve it. That was the case this time, too. I last sat down and coded about a week ago (eek – determined to up the frequency) and couldn’t figure out how to solve the build error. I sat down today and had it fixed within 5 minutes.

Instead of going through the tutorial line by line and making sure my code matches it exactly (which is a perfectly fine way to solve a problem, but it probably wouldn’t teach me much), I try to figure the error out myself. The compiler underlined the undeclared type, which was “MealViewTableCell”, a class that I made the last time I coded. Why couldn’t it find it? I looked at this class – I made it last time I did a tutorial. Turns out that I incorrectly named this file, which should have been “MealTableViewCell” – it’s easy to see how someone could get confused, right? Even though it was a simple naming error, I’m glad I figured this out without resorting to comparing my code line by line to the tutorial.

I finally solved my build error…onto the rest of the tutorial! First I had a checkpoint: I needed to run my app and make sure my TableView is populating with the meal names and pictures that I hard-coded into the table. Just because something builds does not mean you’re out of the woods. I launched the simulator, and my table view was blank.

What the tableview should look like on the left. My app on the right. Nailed it?

Luckily I figured this one out pretty quickly by going back into the tutorial and figuring out where I may have missed a step. When you go a week in between lessons, it can be hard to remember exactly where you left off. What happened was that I forgot to point my Table View Controller to the MealTableViewController class. Once I fixed this, I was able to see my Table View Populate:

Looking more like the tutorial now…


I worked with navigation controllers and segues to build a path through my app. I’m about halfway done with this part of the tutorial, but so far, I added a navigation controller to my app. I then changed the title property of the navigation bar and added a bar button (in “+” form) as well.

I then added a “Show” segue between my meal list and the input screen for adding a new meal. Once I saw what this did, I switched the segue type to “Present Modally”. This kind of segue does not automatically have a navigation bar, so I had to manually add one by embedding it in its own navigation controller.

This is as far as I got today, but I’m really impressed by the built in functionality of the segues in iOS. I hope that this means developing navigation in apps will be easier than I expected. Time will tell!

Leave a Reply

Your email address will not be published. Required fields are marked *