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

I keep getting a fatal error. Not sure why.

I am pretty sure I followed Pasan's instructions exactly. But I keep getting a fatal error when I run the app. Here is the error message.

fatal error: invalidResource: file /Users/work/Dropbox/Code/XCode/DevMountain/Pre Course Material/TeamTreehouse/VendingMachine-StarterFiles/VendingMachine/ViewController.swift, line 30

Line 30 in the ViewControll.swift file is fatalError("\(error)")

3 Answers

Joel Martin
Joel Martin
2,799 Points

If the application crash at that point, it means there is a problem with the "VendingInventory.plist" file.

Have you made any change to that file, or any code related to it ?

what was the the problem am struck at the same spot as you were

I found the issue. I had it looking for the wrong file name.

Anthia Tillbury
Anthia Tillbury
3,388 Points

I had exactly the same issue. The fix was simply to use a lower case "p" for "plist".

Passan did mention (although I wondered why he didn't use an Enum at the time) that issues could arise when using a text string, which is case in point.

What a silly mistake!

Although Xcode did make sense, it could have been less cryptic and definitely offered a simple auto-fix for this, will send feedback to Apple developers.