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 trialLudwing Najera
4,596 PointsIOS simulator crash: is little snitch the culprit? (little snitch is network monitor)
I was running the IOS simulator when little snitch started asking me about connections. i allowed them all and the app crashed. not a problem. i reopened the app then it started up and crashed with a fatal error on this line of code:
let weatherData = NSData(contentsOfURL: forecastURL!, options: nil, error: nil)
does little snitch do anything to the IOS simulator?
the console also said: fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)
7 Answers
Steve Hunter
57,712 PointsIf the app previously ran OK it may be worth turning off the network monitor and trying again. Also, closing Xcode & the simulator and restarting them often clears some weird crashes.
Alternatively, try adding an "exception breakpoint" as that'll provide you with some more information although the debugger is not massively helpful!
Looking at your error, it sounds like the engine got a nil
when it didn't expect one. Does your code check for a network connection before proceeding? Are the nil
entries in your line correct?
Ludwing Najera
4,596 Pointswell in the teachers notes the teacher said to change and old line of code into what you see on my question. the old one looked like this:
NSData.dataWithContentsOfURL(forecastURL, options: nil, error: nil)
it said due to changes to xcode make it look like what is in my question
Steve Hunter
57,712 PointsWith the exclamation mark? That looks odd!
Else, try a restart of Xcode and/or post the exception breakpoint messages.
Steve.
Steve Hunter
57,712 PointsForecastURL!
, I mean ...
Ludwing Najera
4,596 Pointsit says on the exeption EXC_BAD_INSTRUCTION
Steve Hunter
57,712 PointsHi,
What have you tried out? There were a few suggestions:
- Close Xcode & restart it
- Try running without the network monitor
- Check the variable should be called
forecastURL!
as the exclamation mark looks odd - Put an exception breakpoint in to get more details
Did you try these and did they make any progress?
If not, can you zip your project and post a link to it on here?
Steve.
Ludwing Najera
4,596 Pointshow do i link my project
Steve Hunter
57,712 PointsNo idea - zip it and send it to me ... steve.hunter@bigdogconsultants.co.uk
I'll have a look tomorrow to see if I can figure out the problem.
Joseph Kandi
2,640 PointsCan you post the value of your forecastURL