× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

Fatal error when unwrapping CLLocation Location Coordinate

Antonio Bello
Jun 28, 2015
<p>Obtaining the location is an asynchronous operation - in fact the method you invoke to start the op is <code>startUpdatingLocation()</code> and not <code>getLocation()</code>. That is an indication that the process is started, and it's not completed at the time the invoked method returns.</p> <p>The location is provided asynchronously via the <code>func locationManager(manager: CLLocationManager!, didUpdateLocations locations: [AnyObject]!)</code> method, part of the <code>CLLocationManagerDelegate</code> protocol that you must adopt in your class. And of course you have to set the <code>delegate</code> property of the <code>CLLocationManager</code> instance. If you have ever worked with tables, you should know how it works.</p> <p>However, I recommend reading the official docs, or a good tutorial like <a href="http://www.appcoda.com/how-to-get-current-location-iphone-user/" rel="nofollow">this one</a></p> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/30853726/Fatal%20error%20when%20unwrapping%20CLLocation%20Location%20Coordinate/30853913">Stack Overflow</a>.</p>
comments powered by Disqus