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 Vending Machine App in Swift Loading Data From a Resource Finishing Touches

Bekzod Rakhmatov
Bekzod Rakhmatov
7,419 Points

Error

In the video 07:55 my compiler is not happy line 28 is giving an error! self.vendingMachine = FoodVendingMachine(inventory: inventory) to changeself.vendingMachine = FoodVendingMachine(inventory: inventory) as! VendingMachine and I changed it as shown but I can see my console is showing like Could not cast value of type 'VendingMachine.FoodVendingMachine' (0x105b5b4f0) to 'VendingMachine.VendingMachine' (0x60000007f358).

Jacob Smith
Jacob Smith
10,926 Points

Hello Bekzod.

I believe I was having the same issue as you. What I would recommend is:

  • Run your app
  • Highlight line 28
  • Press cmd + 7 (This will hightlight all your breakpoints)
  • In the left hand panel of your Xcode you'll find the Breakpoint Navigator (second tab from the right)
  • There will be some blue pentagon breakpoint shaped emblems. Click on each of those to disable the breakpoints.

Please let me know if that worked. I'm a novice in the field but it seemed to resolve my error.

Best of luck.

Alternatively if you see one of these (blue) breakpoints in the gutter (where your line count is), you can simply drag it away for deletion.