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 trialRoger Antonell
18,252 Pointspresent alert inisde locationManager(_ manager: CLLocationManager, didFailWithError error: Error)
Pasan in minute 3:00 says that he would present alert inside the didFailWithError method, how can i do that? i tried this:
func locationManager(_ manager: CLLocationManager, didFailWithError error: Error) {
let alertView = UIAlertController(title: "Error location", message: "We can't track location, try later", preferredStyle: .alert)
alertView.addAction(UIAlertAction(title: "Done", style: .default, handler: nil))
present(alertView, animated: true, completion: nil)
}
but i can't use this code , because present is a UIViewController method, so wich solution i can implement to show an alert inside a not UIViewController class
thanks