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 Simple iPhone App with Swift Improving Our User Interface Finishing Up Our Layout

I'm getting a strange error when I run the app. Please help!!!

When I run the app, it says that the build has succeeded and then loads the app. A second later, it closes the app and gives an error in the following code:

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var funFactsLabel: UILabel!
let factProvider = FactProvider()

override func viewDidLoad() {
    super.viewDidLoad()

    funFactsLabel.text = factProvider.randomFact() \\Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value (the error)
}

@IBAction func showFact() {
 funFactsLabel.text = factProvider.randomFact()

} }

Hello,

Can you show the implementation of the "randomFact()" method ?

2 Answers

Hi Jhoan,

Thank you for replying however I'm not sure what you mean by implementation. Could you please explain clearer as I'm still kind of new to this?

Sorry about the delay for the answer: I was on holiday

Hope to see your response.

Hey, I apologize, I just got back from vacation..

Are you still having this issue?

"Implementation" is the process of "making" something.. When you "implement" a method, means that you have created or designed a function to do something.

No, I managed to figure it out but thanks anyway.

thx again Aaryen