Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Weather App with Swift Simple Data Structures Loading Files From A Directory

Michael Jones
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Michael Jones
Python Development Techdegree Graduate 38,552 Points

Build a Weather App Using Swift - Challenge Task 1

I'm currently stuck on this challenge. I've entered the following code but I keep getting the bummer message. Not sure where I'm going wrong.

Can someone please explain where I'm going wrong.

Thanks.

plist.swift
import Foundation

// Add your code below
let plistPath = NSBundle.mainBundle().pathForResource("CrazyInformation", ofType: "plist")
let plist = NSDictionary(contentsOfFile: plistPath)

1 Answer

Martin Wildfeuer
PLUS
Martin Wildfeuer
Courses Plus Student 11,071 Points

The problem here is that pathForResource returns an optional String and therefore has to be unwrapped. Take a look at this more in-depth answer.

Hope that helps!