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 trialRyan Jin
15,337 PointsDownloaded project doesn't work
After I download the project, it shows that there are some places that needs to unwrap an optional. And I won't let me run if I don't force unwrap it. So I did force unwrap it, and after that, the app crashes, saying that it found nil while unwrapping an optional. I changed it back, and there is an error. Can somebody give me the right program.
1 Answer
Mohsen Lotfi
2,694 PointsCan you provide your code so we can better understand the situation.
Basically you need to unwrap an optional before using it, however the whole concept of optional is that the value can be nil. in such cases you can check the value to see if its nil before force unwrapping like following
if xyz != nil {
//Do Something
}
Again without the code it is hard to understand the problem.